File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -287,7 +287,9 @@ static void
287
287
capsule_dealloc (PyObject * op )
288
288
{
289
289
PyCapsule * capsule = _PyCapsule_CAST (op );
290
- PyObject_GC_UnTrack (op );
290
+ if (_PyObject_GC_IS_TRACKED (op )) {
291
+ PyObject_GC_UnTrack (op );
292
+ }
291
293
if (capsule -> destructor ) {
292
294
capsule -> destructor (op );
293
295
}
Original file line number Diff line number Diff line change @@ -2201,9 +2201,8 @@ void
2201
2201
PyObject_GC_UnTrack (void * op_raw )
2202
2202
{
2203
2203
PyObject * op = _PyObject_CAST (op_raw );
2204
- /* Obscure: the trashcan mechanism requires that we be able to
2205
- * call PyObject_GC_UnTrack twice on an object.
2206
- */
2204
+ /* The code for some objects, such as tuples, is a bit
2205
+ * sloppy about when the object is tracked and untracked. */
2207
2206
if (_PyObject_GC_IS_TRACKED (op )) {
2208
2207
_PyObject_GC_UNTRACK (op );
2209
2208
}
Original file line number Diff line number Diff line change @@ -2500,9 +2500,8 @@ void
2500
2500
PyObject_GC_UnTrack (void * op_raw )
2501
2501
{
2502
2502
PyObject * op = _PyObject_CAST (op_raw );
2503
- /* Obscure: the trashcan mechanism requires that we be able to
2504
- * call PyObject_GC_UnTrack twice on an object.
2505
- */
2503
+ /* The code for some objects, such as tuples, is a bit
2504
+ * sloppy about when the object is tracked and untracked. */
2506
2505
if (_PyObject_GC_IS_TRACKED (op )) {
2507
2506
_PyObject_GC_UNTRACK (op );
2508
2507
}
You can’t perform that action at this time.
0 commit comments