Skip to content

Commit 5c189da

Browse files
committed
ENH: Propogate macro from Python3.12
1 parent 48dd28f commit 5c189da

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/PythonQt.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1148,7 +1148,18 @@ void PythonQt::removeVariable(PyObject* object, const QString& name)
11481148
if (PyDict_Check(object)) {
11491149
PyDict_DelItemString(object, QStringToPythonCharPointer(name));
11501150
} else {
1151-
PyObject_DelAttrString(object, QStringToPythonCharPointer(name));
1151+
1152+
/* Implemented as a macro:
1153+
1154+
int PyObject_DelAttrString(PyObject *o, const char *attr_name);
1155+
1156+
Delete attribute named attr_name, for object o. Returns
1157+
-1 on failure.
1158+
1159+
This is the equivalent of the Python statement: del o.attr_name. */
1160+
#define XXPyObject_DelAttrString(O, A) PyObject_SetAttrString((O), (A), NULL)
1161+
1162+
XXPyObject_DelAttrString(object, QStringToPythonCharPointer(name));
11521163
}
11531164
}
11541165

0 commit comments

Comments
 (0)