summarylogtreecommitdiffstats
path: root/wxpython-nuitka-methods.patch
blob: 49a3f6f29f1da27837597843e61d2106774c6041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
diff -uw old/wxPython/src/helpers.cpp new/wxPython/src/helpers.cpp
--- old/wxPython/src/helpers.cpp	2015-01-06 23:33:57.306574595 +0100
+++ new/wxPython/src/helpers.cpp	2015-01-06 23:31:59.406447996 +0100
@@ -1945,15 +1945,23 @@

 void wxPyCallbackHelper::setRecursionGuard(PyObject* method) const
 {
-    PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method);
+    if (PyMethod_Check(method)) {
+        PyFunctionObject* func = (PyFunctionObject*)PyMethod_GET_FUNCTION(method);
     PyObject_SetAttr(m_self, func->func_name, Py_None);
+    } else {
+        PyObject* name = PyObject_GetAttrString(method, "__name__");
+        PyObject_SetAttr(m_self, name, Py_None);
+    }
 }

 void wxPyCallbackHelper::clearRecursionGuard(PyObject* method) const
 {
-    PyFunctionObject* func = (PyFunctionObject*)PyMethod_Function(method);
-    if (PyObject_HasAttr(m_self, func->func_name)) {
-        PyObject_DelAttr(m_self, func->func_name);
+    if (PyMethod_Check(method)) {
+        PyFunctionObject* func = (PyFunctionObject*)PyMethod_GET_FUNCTION(method);
+        PyObject_SetAttr(m_self, func->func_name, NULL);
+    } else {
+        PyObject* name = PyObject_GetAttrString(method, "__name__");
+        PyObject_SetAttr(m_self, name, NULL);
     }
 }