fixed PyMethod_New() call
authorStefan Behnel <scoder@users.berlios.de>
Thu, 15 May 2008 07:38:35 +0000 (09:38 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 15 May 2008 07:38:35 +0000 (09:38 +0200)
Cython/Compiler/ExprNodes.py
Cython/Compiler/ModuleNode.py

index d659c9c99bc9b2856bc9c4d6e5e21492a488fb7c..cbcd25865e1de38780782444c24f41ea3843d130 100644 (file)
@@ -2470,7 +2470,7 @@ class UnboundMethodNode(ExprNode):
     
     def generate_result_code(self, code):
         code.putln(
-            "%s = PyMethod_New(%s, 0, %s); %s" % (
+            "%s = __Pyx_PyMethod_New(%s, 0, %s); %s" % (
                 self.result_code,
                 self.function.py_result(),
                 self.class_cname,
index 7c4fff7172a3050a300a606872c1c99392aca2f2..db0122d3355ab8291c7dbfb1bf4c9866cd160df0 100644 (file)
@@ -415,8 +415,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
         code.putln("#endif")
 
         code.putln("#if PY_MAJOR_VERSION >= 3")
-        code.putln("  #define PyMethod_New(func, self, klass) (func!=NULL?(Py_INCREF(func),func):NULL)")
-        code.putln("  #define PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)")
+        code.putln("  #define PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)")
+        code.putln("  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, klass)")
+        code.putln("#else")
+        code.putln("  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)")
         code.putln("#endif")
 
         code.putln("#ifndef __stdcall")