diff --git a/atom/src/signalconnector.cpp b/atom/src/signalconnector.cpp index 47fb52c8..d4d18931 100644 --- a/atom/src/signalconnector.cpp +++ b/atom/src/signalconnector.cpp @@ -35,10 +35,7 @@ SignalConnector_traverse( SignalConnector* self, visitproc visit, void* arg ) { Py_VISIT( self->member ); Py_VISIT( self->atom ); -#if PY_VERSION_HEX >= 0x03090000 - // This was not needed before Python 3.9 (Python issue 35810 and 40217) Py_VISIT(Py_TYPE(self)); -#endif return 0; } @@ -51,7 +48,13 @@ SignalConnector_dealloc( SignalConnector* self ) if( numfree < FREELIST_MAX ) freelist[ numfree++ ] = self; else - Py_TYPE(self)->tp_free( pyobject_cast( self ) ); + { + PyTypeObject* tp = Py_TYPE( self ); + tp->tp_free( pyobject_cast( self ) ); + Py_DECREF( tp ); + + } + } @@ -182,6 +185,7 @@ SignalConnector::New( atom::Member* member, atom::CAtom* atom ) { pyconnector = pyobject_cast( freelist[ --numfree ] ); _Py_NewReference( pyconnector ); + PyObject_GC_Track( pyconnector ); } else {