[Python-modules-commits] r24404 - in packages/shiboken/trunk/debian/patches (2 files)

odyx at users.alioth.debian.org odyx at users.alioth.debian.org
Thu May 16 15:09:08 UTC 2013


    Date: Thursday, May 16, 2013 @ 15:09:06
  Author: odyx
Revision: 24404

Add static-override-fix.patch to fix broken static/non-static overloads in python3.

Added:
  packages/shiboken/trunk/debian/patches/static-override-fix.patch
Modified:
  packages/shiboken/trunk/debian/patches/series

Modified: packages/shiboken/trunk/debian/patches/series
===================================================================
--- packages/shiboken/trunk/debian/patches/series	2013-05-16 15:08:55 UTC (rev 24403)
+++ packages/shiboken/trunk/debian/patches/series	2013-05-16 15:09:06 UTC (rev 24404)
@@ -2,3 +2,4 @@
 pythonversionindep.patch
 python3.3-and-multiarch.patch
 memleak-instead-crash.patch
+static-override-fix.patch

Added: packages/shiboken/trunk/debian/patches/static-override-fix.patch
===================================================================
--- packages/shiboken/trunk/debian/patches/static-override-fix.patch	                        (rev 0)
+++ packages/shiboken/trunk/debian/patches/static-override-fix.patch	2013-05-16 15:09:06 UTC (rev 24404)
@@ -0,0 +1,58 @@
+Description: fix static/non-static override
+ using a METH_STATIC function for non static does not work in python3 anymore.
+ Hack around it by emitting a second PyMethodDef
+Bug: https://bugreports.qt-project.org/browse/PYSIDE-145
+Forwarded: yes
+Author: Julian Taylor <jtaylor at ubuntu.com>
+--- shiboken-1.1.2.orig/generator/shiboken/cppgenerator.h
++++ shiboken-1.1.2/generator/shiboken/cppgenerator.h
+@@ -207,7 +207,7 @@ private:
+ 
+     void writeClassRegister(QTextStream& s, const AbstractMetaClass* metaClass);
+     void writeClassDefinition(QTextStream& s, const AbstractMetaClass* metaClass);
+-    void writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads);
++    void writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads, bool nostatic=false);
+     void writeMethodDefinition(QTextStream& s, const AbstractMetaFunctionList overloads);
+ 
+     /// Writes the implementation of all methods part of python sequence protocol
+--- shiboken-1.1.2.orig/generator/shiboken/cppgenerator.cpp
++++ shiboken-1.1.2/generator/shiboken/cppgenerator.cpp
+@@ -308,6 +308,11 @@ void CppGenerator::generateClass(QTextSt
+                 smd << INDENT;
+                 writeMethodDefinitionEntry(smd, overloads);
+                 smd << endl << "};" << endl << endl;
++                methDefName = cpythonMethodDefinitionName(rfunc) + "_nonstatic";
++                smd << "static PyMethodDef " << methDefName << " = {" << endl;
++                smd << INDENT;
++                writeMethodDefinitionEntry(smd, overloads, true);
++                smd << endl << "};" << endl << endl;
+             }
+             writeMethodDefinition(md, overloads);
+         }
+@@ -3897,7 +3902,7 @@ void CppGenerator::writeRichCompareFunct
+     s << '}' << endl << endl;
+ }
+ 
+-void CppGenerator::writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads)
++void CppGenerator::writeMethodDefinitionEntry(QTextStream& s, const AbstractMetaFunctionList overloads, bool nostatic)
+ {
+     Q_ASSERT(!overloads.isEmpty());
+     OverloadData overloadData(overloads, this);
+@@ -3917,7 +3922,7 @@ void CppGenerator::writeMethodDefinition
+         if (overloadData.hasArgumentWithDefaultValue())
+             s << "|METH_KEYWORDS";
+     }
+-    if (func->ownerClass() && overloadData.hasStaticFunction())
++    if (!nostatic && func->ownerClass() && overloadData.hasStaticFunction())
+         s << "|METH_STATIC";
+ }
+ 
+@@ -4531,7 +4536,7 @@ void CppGenerator::writeGetattroFunction
+             foreach (const AbstractMetaFunction* func, getMethodsWithBothStaticAndNonStaticMethods(metaClass)) {
+                 s << INDENT << "if (Shiboken::String::compare(name, \"" << func->name() << "\") == 0)" << endl;
+                 Indentation indent(INDENT);
+-                s << INDENT << "return PyCFunction_NewEx(&" << cpythonMethodDefinitionName(func) << ", " PYTHON_SELF_VAR ", 0);" << endl;
++                s << INDENT << "return PyCFunction_NewEx(&" << cpythonMethodDefinitionName(func) << "_nonstatic" << ", " PYTHON_SELF_VAR ", 0);" << endl;
+             }
+         }
+         s << INDENT << '}' << endl;




More information about the Python-modules-commits mailing list