File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3150,10 +3150,11 @@ void
31503150_Py_Dealloc (PyObject * op )
31513151{
31523152 PyTypeObject * type = Py_TYPE (op );
3153+ unsigned long gc_flags = type -> tp_flags & Py_TPFLAGS_HAVE_GC ;
31533154 destructor dealloc = type -> tp_dealloc ;
31543155 PyThreadState * tstate = _PyThreadState_GET ();
31553156 intptr_t margin = _Py_RecursionLimit_GetMargin (tstate );
3156- if (margin < 2 && PyObject_IS_GC ( op ) ) {
3157+ if (margin < 2 && gc_flags ) {
31573158 _PyTrash_thread_deposit_object (tstate , (PyObject * )op );
31583159 return ;
31593160 }
@@ -3199,7 +3200,7 @@ _Py_Dealloc(PyObject *op)
31993200 Py_XDECREF (old_exc );
32003201 Py_DECREF (type );
32013202#endif
3202- if (tstate -> delete_later && margin >= 4 ) {
3203+ if (tstate -> delete_later && margin >= 4 && gc_flags ) {
32033204 _PyTrash_thread_destroy_chain (tstate );
32043205 }
32053206}
You can’t perform that action at this time.
0 commit comments