[Pyrex] lvalue cast problem against GCC 4.0 in 0.9.3.1

Lorenzo Mancini lmancini at develer.com
Mon Sep 19 19:25:26 CEST 2005


I found another lvalue cast problem with Pyrex 0.9.3.1 vs GCC 4.0.

This is a pyx code that triggers the problem:

------------------------------------------------------------------------
cdef class P:
         pass

cdef class X:
         cdef P a
         def __init__(self):
		self.a = None
------------------------------------------------------------------------

The offending C code follows:

------------------------------------------------------------------------
/* "test.pyx":7 */
/* snip... */
   ((PyObject *)((struct __pyx_obj_5test_X *)__pyx_v_self)->a) = Py_None;
------------------------------------------------------------------------

This patch fixes my instance of the problem.

--- ExprNodes.py        2005-09-19 18:56:25.000000000 +0200
+++ ExprNodes.py        2005-09-19 18:59:44.000000000 +0200
@@ -1588,7 +1588,7 @@
      def select_code(self):
          code = self.uncast_select_code()
          if self.type.is_extension_type:
-            code = "((PyObject *)%s)" % code
+            code = "(%s)" % code
          return code

-- 
Lorenzo Mancini



More information about the Pyrex mailing list