aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2021-12-23 10:19:23 +0100
committerChristian Tismer <tismer@stackless.com>2022-01-05 15:51:40 +0100
commitd7526db85fcec588fa6ca643bd6fb8a9f45c3fc2 (patch)
tree165a849b190e80d67905b342f15eeff7ed5583ed /sources/shiboken6/generator/shiboken/cppgenerator.cpp
parent981ffb345928cf740a5b751aaef43a266d077d13 (diff)
PyPySide: Do some cleanup and Improvements
For more clarity, the function SbkObject_GetDict is renamed to SbkObject_GetDict_NoRef. The internal __dict__ implementation SbkObjectGetDict is re-written to use SbkObject_GetDict_NoRef, which is more correct because of PyPy's tp_dict handling. Task-number: PYSIDE-535 Change-Id: I28034d9199918859de809fde08c413b4b66a3136 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.cpp')
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index f93024d55..e7f0f5351 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -6084,8 +6084,8 @@ void CppGenerator::writeGetattroFunction(TextStream &s, AttroCheck attroCheck,
if (attroCheck.testFlag(AttroCheckFlag::GetattroOverloads)) {
s << "// Search the method in the instance dict\n"
- << "auto ob_dict = SbkObject_GetDict(self);\n";
- s << "if (auto meth = PyDict_GetItem(ob_dict, name)) {\n";
+ << "auto *ob_dict = SbkObject_GetDict_NoRef(self);\n";
+ s << "if (auto *meth = PyDict_GetItem(ob_dict, name)) {\n";
{
Indentation indent(s);
s << "Py_INCREF(meth);\n"
@@ -6098,7 +6098,7 @@ 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.