From a16476005f19e287f7c4d2d6f86587d58c5bf837 Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Thu, 30 Apr 2026 13:54:53 -0400 Subject: [PATCH 1/2] Update methodwrapper --- atom/src/methodwrapper.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/atom/src/methodwrapper.cpp b/atom/src/methodwrapper.cpp index dd787055..4bc8cbf5 100644 --- a/atom/src/methodwrapper.cpp +++ b/atom/src/methodwrapper.cpp @@ -27,9 +27,11 @@ namespace void MethodWrapper_dealloc( MethodWrapper* self ) { + PyTypeObject *tp = Py_TYPE( self ); Py_CLEAR( self->im_selfref ); Py_CLEAR( self->im_func ); - Py_TYPE(self)->tp_free( pyobject_cast( self ) ); + tp->tp_free( pyobject_cast( self ) ); + Py_DECREF( tp ); } @@ -133,10 +135,12 @@ namespace void AtomMethodWrapper_dealloc( AtomMethodWrapper* self ) { + PyTypeObject *tp = Py_TYPE( self ); Py_CLEAR( self->im_func ); // manual destructor since Python malloc'd and zero'd the struct self->pointer.~CAtomPointer(); - Py_TYPE(self)->tp_free( pyobject_cast( self ) ); + tp->tp_free( pyobject_cast( self ) ); + Py_DECREF( tp ); } @@ -210,7 +214,7 @@ PyTypeObject* AtomMethodWrapper::TypeObject = NULL; PyType_Spec AtomMethodWrapper::TypeObject_Spec = { PACKAGE_TYPENAME( "AtomMethodWrapper" ), /* tp_name */ - sizeof( MethodWrapper ), /* tp_basicsize */ + sizeof( AtomMethodWrapper ), /* tp_basicsize */ 0, /* tp_itemsize */ Py_TPFLAGS_DEFAULT, /* tp_flags */ AtomMethodWrapper_Type_slots /* slots */ From a738a2eda76686c4a91d0e0f9e2d2bd98b383bb2 Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Thu, 30 Apr 2026 13:55:53 -0400 Subject: [PATCH 2/2] Reformat --- tests/test_default_values.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_default_values.py b/tests/test_default_values.py index 6a411198..12ef307d 100644 --- a/tests/test_default_values.py +++ b/tests/test_default_values.py @@ -179,7 +179,7 @@ class SetTest(Atom): 5, DefaultValue.MemberMethod_Object, ), - (ForwardTyped(lambda: int, factory=lambda: (5)), 5, DefaultValue.CallObject), + (ForwardTyped(lambda: int, factory=lambda: 5), 5, DefaultValue.CallObject), (Instance(int, ("101",), {"base": 2}), 5, DefaultValue.CallObject), (Instance(int, factory=lambda: 5), 5, DefaultValue.CallObject), (