File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -3150,10 +3150,11 @@ void
3150
3150
_Py_Dealloc (PyObject * op )
3151
3151
{
3152
3152
PyTypeObject * type = Py_TYPE (op );
3153
+ unsigned long gc_flags = type -> tp_flags & Py_TPFLAGS_HAVE_GC ;
3153
3154
destructor dealloc = type -> tp_dealloc ;
3154
3155
PyThreadState * tstate = _PyThreadState_GET ();
3155
3156
intptr_t margin = _Py_RecursionLimit_GetMargin (tstate );
3156
- if (margin < 2 && PyObject_IS_GC ( op ) ) {
3157
+ if (margin < 2 && gc_flags ) {
3157
3158
_PyTrash_thread_deposit_object (tstate , (PyObject * )op );
3158
3159
return ;
3159
3160
}
@@ -3199,7 +3200,7 @@ _Py_Dealloc(PyObject *op)
3199
3200
Py_XDECREF (old_exc );
3200
3201
Py_DECREF (type );
3201
3202
#endif
3202
- if (tstate -> delete_later && margin >= 4 ) {
3203
+ if (tstate -> delete_later && margin >= 4 && gc_flags ) {
3203
3204
_PyTrash_thread_destroy_chain (tstate );
3204
3205
}
3205
3206
}
You can’t perform that action at this time.
0 commit comments