From b4e8f7929974d1a9b40f6356f2face09309150ae Mon Sep 17 00:00:00 2001 From: Kay Hayen Date: Sun, 21 Mar 2021 12:32:06 +0100 Subject: [PATCH 3/6] Nuitka: Actually calling tp_descr_get is universal --- sources/shiboken6/generator/shiboken/cppgenerator.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index 9eec438a6..2c31c97f5 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -5794,10 +5794,13 @@ void CppGenerator::writeGetattroFunction(TextStream &s, AttroCheck attroCheck, Indentation indent(s); // PYSIDE-772: Perform optimized name mangling. s << "Shiboken::AutoDecRef tmp(_Pep_PrivateMangle(self, name));\n" - << "if (auto meth = PyDict_GetItem(Py_TYPE(self)->tp_dict, tmp))\n"; + << "if (auto meth = PyDict_GetItem(Py_TYPE(self)->tp_dict, tmp)) {\n"; { Indentation indent(s); + // PYSIDE-1523: PyFunction_Check is not accepting compiled functions. + s << "if (strcmp(Py_TYPE(meth)->tp_name, \"compiled_function\") == 0) return Py_TYPE(meth)->tp_descr_get(meth, self, NULL);\n"; s << "return PyFunction_Check(meth) ? SBK_PyMethod_New(meth, self) : " << getattrFunc << ";\n"; + s << "}\n"; } } s << "}\n"; -- 2.30.0.windows.2