Skip to content

Commit a9f0e95

Browse files
Vipul-Cariappaguitargeek
authored andcommitted
refactor typedefpointertoclassobject to not participate in Cyclic GC
1 parent e37fefd commit a9f0e95

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

bindings/pyroot/cppyy/CPyCppyy/src/CPPScope.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,8 @@ static PyObject* meta_getattro(PyObject* pyclass, PyObject* pyname)
401401
Cppyy::TCppType_t tcl = Cppyy::GetScope(clean);
402402
if (tcl) {
403403
typedefpointertoclassobject* tpc =
404-
PyObject_GC_New(typedefpointertoclassobject, &TypedefPointerToClass_Type);
404+
PyObject_New(typedefpointertoclassobject, &TypedefPointerToClass_Type);
405405
tpc->fCppType = tcl;
406-
tpc->fDict = PyDict_New();
407406
attr = (PyObject*)tpc;
408407
}
409408
}

bindings/pyroot/cppyy/CPyCppyy/src/CustomPyTypes.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ PyTypeObject TypedefPointerToClass_Type = {
144144
0, // tp_dict
145145
0, // tp_descr_get
146146
0, // tp_descr_set
147-
offsetof(typedefpointertoclassobject, fDict), // tp_dictoffset
147+
0, // tp_dictoffset
148148
0, // tp_init
149149
0, // tp_alloc
150150
0, // tp_new

bindings/pyroot/cppyy/CPyCppyy/src/CustomPyTypes.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,6 @@ inline bool RefInt_CheckExact(T* object)
4343
struct typedefpointertoclassobject {
4444
PyObject_HEAD
4545
Cppyy::TCppType_t fCppType;
46-
PyObject* fDict;
47-
48-
~typedefpointertoclassobject() {
49-
Py_DECREF(fDict);
50-
}
5146
};
5247

5348
extern PyTypeObject TypedefPointerToClass_Type;

0 commit comments

Comments
 (0)