Re: DBUS and gcc-4.0.1



Ah, you need one of these patches which still hasn't been applied to
Pyrex upstream for some reason.

The 9.2.1 patch is the one we use in Fedora.  The 0.9.3 is a newer one
that fixes some other lvalue errors though I haven't tested it on D-Bus
yet.  if the 0.9.3 one works, use that.  If not then use the older
patch.

On Wed, 2005-08-17 at 22:51 +0200, Stef van der Made wrote:
> Dear Joseph,
> 
> If I rember correcly you are using GCC 4.0.1 as well ?
> 
> I seem to be having issues compiling dbus 0.35.2 or the version in CVS. 
> Did you or anybody success in compiling dbus using this version of GCC 
> or I'm a looking in the wrong direction for the issues
> 
> Thanks in advance for any tips,
> 
> Stef
> 
> the compile log
> 
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_cunregister_function_handler':
> dbus_bindings.c:1003: error: invalid lvalue in assignment
> dbus_bindings.c:1056: error: invalid lvalue in assignment
> dbus_bindings.c:1080: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_cmessage_function_handler':
> dbus_bindings.c:1137: error: invalid lvalue in assignment
> dbus_bindings.c:1138: error: invalid lvalue in assignment
> dbus_bindings.c:1194: error: invalid lvalue in assignment
> dbus_bindings.c:1207: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection___del__':
> dbus_bindings.c:1447: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection__set_conn':
> dbus_bindings.c:1464: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection__get_conn':
> dbus_bindings.c:1481: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_disconnect':
> dbus_bindings.c:1535: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_flush':
> dbus_bindings.c:1605: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_borrow_message':
> dbus_bindings.c:1624: error: invalid lvalue in assignment
> dbus_bindings.c:1637: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_pop_message':
> dbus_bindings.c:1732: error: invalid lvalue in assignment
> dbus_bindings.c:1752: error: invalid lvalue in assignment
> dbus_bindings.c:1766: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_send_with_reply':
> dbus_bindings.c:2031: error: invalid lvalue in assignment
> dbus_bindings.c:2072: error: invalid lvalue in assignment
> dbus_bindings.c:2085: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_send_with_reply_and_block':
> dbus_bindings.c:2138: error: invalid lvalue in assignment
> dbus_bindings.c:2190: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_set_watch_functions':
> dbus_bindings.c:2235: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_set_timeout_functions':
> dbus_bindings.c:2263: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_set_wakeup_main_function':
> dbus_bindings.c:2289: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_set_data':
> dbus_bindings.c:2371: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_get_data':
> dbus_bindings.c:2394: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_10Connection_list_registered':
> dbus_bindings.c:2748: warning: label '__pyx_L4' defined but not used
> dbus_bindings.c:2723: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings__pending_call_notification':
> dbus_bindings.c:2794: error: invalid lvalue in assignment
> dbus_bindings.c:2828: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings__pending_call_free_user_data':
> dbus_bindings.c:2969: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall___cinit__':
> dbus_bindings.c:3023: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall___del__':
> dbus_bindings.c:3049: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall__get_pending_call':
> dbus_bindings.c:3066: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall_cancel':
> dbus_bindings.c:3085: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall_get_reply':
> dbus_bindings.c:3129: error: invalid lvalue in assignment
> dbus_bindings.c:3142: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11PendingCall_block':
> dbus_bindings.c:3180: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_5Watch___init__':
> dbus_bindings.c:3243: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_5Watch___cinit__':
> dbus_bindings.c:3260: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter___cinit__':
> dbus_bindings.c:3406: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter__get_iter':
> dbus_bindings.c:3423: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_get_dict':
> dbus_bindings.c:4354: error: invalid lvalue in assignment
> dbus_bindings.c:4377: error: invalid lvalue in assignment
> dbus_bindings.c:4507: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:4402: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_get_array':
> dbus_bindings.c:4557: error: invalid lvalue in assignment
> dbus_bindings.c:4580: error: invalid lvalue in assignment
> dbus_bindings.c:4674: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:4605: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_get_variant':
> dbus_bindings.c:4712: error: invalid lvalue in assignment
> dbus_bindings.c:4732: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_get_struct':
> dbus_bindings.c:4779: error: invalid lvalue in assignment
> dbus_bindings.c:4801: error: invalid lvalue in assignment
> dbus_bindings.c:4857: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:4816: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_python_value_to_dbus_sig':
> dbus_bindings.c:6030: warning: label '__pyx_L7' defined but not used
> dbus_bindings.c:6004: warning: label '__pyx_L6' defined but not used
> dbus_bindings.c:5312: warning: label '__pyx_L5' defined but not used
> dbus_bindings.c:5286: warning: label '__pyx_L4' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_append_dict':
> dbus_bindings.c:7423: error: invalid lvalue in assignment
> dbus_bindings.c:7424: error: invalid lvalue in assignment
> dbus_bindings.c:7547: error: invalid lvalue in assignment
> dbus_bindings.c:7589: error: invalid lvalue in assignment
> dbus_bindings.c:7619: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:7557: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_append_struct':
> dbus_bindings.c:7665: error: invalid lvalue in assignment
> dbus_bindings.c:7689: error: invalid lvalue in assignment
> dbus_bindings.c:7734: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:7699: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter_append_array':
> dbus_bindings.c:7781: error: invalid lvalue in assignment
> dbus_bindings.c:7823: error: invalid lvalue in assignment
> dbus_bindings.c:7880: warning: label '__pyx_L3' defined but not used
> dbus_bindings.c:7845: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_11MessageIter___str__':
> dbus_bindings.c:7965: error: invalid lvalue in assignment
> dbus_bindings.c:8293: error: invalid lvalue in assignment
> dbus_bindings.c:7988: warning: label '__pyx_L2' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message___del__':
> dbus_bindings.c:8582: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message__set_msg':
> dbus_bindings.c:8929: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message__get_msg':
> dbus_bindings.c:8946: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message_get_iter':
> dbus_bindings.c:8968: error: invalid lvalue in assignment
> dbus_bindings.c:8997: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message_get_args_list':
> dbus_bindings.c:9146: warning: label '__pyx_L5' defined but not used
> dbus_bindings.c:9117: warning: label '__pyx_L4' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_7Message_get_sender':
> dbus_bindings.c:9512: warning: assignment discards qualifiers from pointer target type
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_6Server_disconnect':
> dbus_bindings.c:10120: warning: label '__pyx_L1' defined but not used
> dbus_bindings.c: In function '__pyx_f_13dbus_bindings_bus_get':
> dbus_bindings.c:10167: error: invalid lvalue in assignment
> dbus_bindings.c:10197: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_Connection':
> dbus_bindings.c:10896: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_Connection':
> dbus_bindings.c:10901: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_Connection':
> dbus_bindings.c:10907: warning: unused variable 'p'
> dbus_bindings.c:10906: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_Connection':
> dbus_bindings.c:10912: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_Message':
> dbus_bindings.c:11070: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_Message':
> dbus_bindings.c:11075: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_Message':
> dbus_bindings.c:11081: warning: unused variable 'p'
> dbus_bindings.c:11080: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_Message':
> dbus_bindings.c:11086: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_PendingCall':
> dbus_bindings.c:11241: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_PendingCall':
> dbus_bindings.c:11246: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_PendingCall':
> dbus_bindings.c:11252: warning: unused variable 'p'
> dbus_bindings.c:11251: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_PendingCall':
> dbus_bindings.c:11257: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_Watch':
> dbus_bindings.c:11391: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_Watch':
> dbus_bindings.c:11396: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_Watch':
> dbus_bindings.c:11402: warning: unused variable 'p'
> dbus_bindings.c:11401: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_Watch':
> dbus_bindings.c:11407: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_MessageIter':
> dbus_bindings.c:11538: error: invalid lvalue in assignment
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_MessageIter':
> dbus_bindings.c:11543: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_MessageIter':
> dbus_bindings.c:11549: warning: unused variable 'p'
> dbus_bindings.c:11548: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_MessageIter':
> dbus_bindings.c:11554: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_new_13dbus_bindings_Server':
> dbus_bindings.c:11718: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_dealloc_13dbus_bindings_Server':
> dbus_bindings.c:11723: warning: unused variable 'p'
> dbus_bindings.c: In function '__pyx_tp_traverse_13dbus_bindings_Server':
> dbus_bindings.c:11729: warning: unused variable 'p'
> dbus_bindings.c:11728: warning: unused variable 'e'
> dbus_bindings.c: In function '__pyx_tp_clear_13dbus_bindings_Server':
> dbus_bindings.c:11734: warning: unused variable 'p'
> dbus_bindings.c: In function 'initdbus_bindings':
> dbus_bindings.c:11914: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:11921: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:11928: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:11934: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:11941: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:11944: warning: dereferencing type-punned pointer will break strict-aliasing rules
> dbus_bindings.c:12289: warning: assignment from incompatible pointer type
> dbus_bindings.c:12299: warning: assignment from incompatible pointer type
> dbus_bindings.c:12562: warning: assignment from incompatible pointer type
> dbus_bindings.c:12567: warning: assignment from incompatible pointer type
> dbus_bindings.c: In function '__Pyx_EndUnpack':
> dbus_bindings.c:12802: warning: suggest parentheses around assignment used as truth value
> make[3]: *** [dbus_bindings.lo] Error 1
> make[2]: *** [all-recursive] Error 1
> make[1]: *** [all-recursive] Error 1
> make: *** [all] Error 2
> 
> 
-- 
John (J5) Palmieri <johnp redhat com>
--- Pyrex-0.9.2.1/Pyrex/Compiler/Code.py.orig	2005-03-22 13:41:29.000000000 -0500
+++ Pyrex-0.9.2.1/Pyrex/Compiler/Code.py	2005-03-22 13:46:15.000000000 -0500
@@ -218,14 +218,19 @@
         for entry in entries:
             self.put_var_xdecref_clear(entry)
     
-    def put_init_to_py_none(self, cname):
-        self.putln("%s = Py_None; Py_INCREF(%s);" % (cname, cname))
+    def put_init_to_py_none(self, cast, cname):
+        if cast:
+            self.putln("%s = Py_None; Py_INCREF(%s %s);" % (cname, cast, cname))
+        else:
+            self.putln("%s = Py_None; Py_INCREF(%s);" % (cname, cname))            
     
     def put_init_var_to_py_none(self, entry, template = "%s"):
         code = template % entry.cname
         if entry.type.is_extension_type:
-            code = "((PyObject*)%s)" % code
-        self.put_init_to_py_none(code)
+            cast = "(PyObject *)"
+        else:
+            cast = None
+        self.put_init_to_py_none(cast, code)
 
     def put_pymethoddef(self, entry, term):
         if entry.doc:
--- Pyrex-0.9.2.1/Pyrex/Compiler/ExprNodes.py.orig	2005-03-22 13:41:35.000000000 -0500
+++ Pyrex-0.9.2.1/Pyrex/Compiler/ExprNodes.py	2005-03-22 13:34:05.000000000 -0500
@@ -806,7 +806,7 @@
             if self.type.is_pyobject:
                 rhs.make_owned_reference(code)
                 code.put_decref(self.result, self.type)
-            code.putln('%s = %s;' % (self.result, rhs.result))
+            code.putln('%s = %s;' % (self.entry.cname, rhs.result))
             if debug_disposal_code:
                 print "NameNode.generate_assignment_code:"
                 print "...generating post-assignment code for", rhs
--- Pyrex-0.9.2.1/Pyrex/Compiler/Nodes.py.orig	2005-03-22 13:41:40.000000000 -0500
+++ Pyrex-0.9.2.1/Pyrex/Compiler/Nodes.py	2005-03-22 13:43:36.000000000 -0500
@@ -472,9 +472,9 @@
         self.generate_self_cast(scope, code)
         type = scope.parent_type
         if type.vtabslot_cname:
-            code.putln("(struct %s *)p->%s = %s;" % (
-                type.vtabstruct_cname,
+            code.putln("p->%s = (struct %s *)%s;" % (
                 type.vtabslot_cname,
+                type.vtabstruct_cname,
                 type.vtabptr_cname))
         for entry in scope.var_entries:
             if entry.type.is_pyobject:
@@ -1671,10 +1671,11 @@
         code.putln("")
         if self.return_type.is_pyobject:
             if self.return_type.is_extension_type:
-                lhs = "(PyObject *)%s" % Naming.retval_cname
+                cast = "(PyObject *)"
             else:
-                lhs = Naming.retval_cname
-            code.put_init_to_py_none(lhs)
+                cast = None
+            lhs = Naming.retval_cname
+            code.put_init_to_py_none(cast, lhs)
         else:
             val = self.return_type.default_value
             if val:
diff -ur Pyrex-0.9.3.orig/Pyrex/Compiler/Code.py Pyrex-0.9.3/Pyrex/Compiler/Code.py
--- Pyrex-0.9.3.orig/Pyrex/Compiler/Code.py	2003-07-08 10:31:27.000000000 +0200
+++ Pyrex-0.9.3/Pyrex/Compiler/Code.py	2005-06-16 22:51:58.000000000 +0200
@@ -218,14 +218,19 @@
         for entry in entries:
             self.put_var_xdecref_clear(entry)
     
-    def put_init_to_py_none(self, cname):
-        self.putln("%s = Py_None; Py_INCREF(%s);" % (cname, cname))
+    def put_init_to_py_none(self, cast, cname):
+        if cast:
+            self.putln("%s = Py_None; Py_INCREF(%s %s);" % (cname, cast, cname))
+        else:
+            self.putln("%s = Py_None; Py_INCREF(%s);" % (cname, cname))            
     
     def put_init_var_to_py_none(self, entry, template = "%s"):
         code = template % entry.cname
         if entry.type.is_extension_type:
-            code = "((PyObject*)%s)" % code
-        self.put_init_to_py_none(code)
+            cast = "(PyObject *)"
+        else:
+            cast = None
+        self.put_init_to_py_none(cast, code)
 
     def put_pymethoddef(self, entry, term):
         if entry.doc:
diff -ur Pyrex-0.9.3.orig/Pyrex/Compiler/ExprNodes.py Pyrex-0.9.3/Pyrex/Compiler/ExprNodes.py
--- Pyrex-0.9.3.orig/Pyrex/Compiler/ExprNodes.py	2004-05-01 12:15:07.000000000 +0200
+++ Pyrex-0.9.3/Pyrex/Compiler/ExprNodes.py	2005-06-16 22:52:23.000000000 +0200
@@ -806,7 +806,7 @@
             if self.type.is_pyobject:
                 rhs.make_owned_reference(code)
                 code.put_decref(self.result, self.type)
-            code.putln('%s = %s;' % (self.result, rhs.result))
+            code.putln('%s = %s;' % (self.entry.cname, rhs.result))
             if debug_disposal_code:
                 print "NameNode.generate_assignment_code:"
                 print "...generating post-assignment code for", rhs
@@ -1580,16 +1580,18 @@
             return NameNode.is_ephemeral(self)
     
     def result_code(self):
-        return self.select_code()
+        return self.select_code()[0]
     
     def result_as_extension_type(self):
         return self.uncast_select_code()
     
     def select_code(self):
-        code = self.uncast_select_code()
+        orig_code = self.uncast_select_code()
         if self.type.is_extension_type:
-            code = "((PyObject *)%s)" % code
-        return code
+            code = "((PyObject *)%s)" % orig_code
+        else:
+            code = orig_code
+        return code, orig_code
     
     def uncast_select_code(self):
         obj_type = self.obj.type
@@ -1642,13 +1644,13 @@
                         code.error_goto(self.pos)))
             rhs.generate_disposal_code(code)
         else:
-            select_code = self.select_code()
+            select_code, orig_code = self.select_code()
             if self.type.is_pyobject:
                 rhs.make_owned_reference(code)
                 code.put_decref(select_code, self.type)
             code.putln(
                 "%s = %s;" % (
-                    select_code,
+                    orig_code,
                     rhs.result))
             rhs.generate_post_assignment_code(code)
         self.obj.generate_disposal_code(code)
Seulement dans Pyrex-0.9.3/Pyrex/Compiler: ExprNodes.py.orig
diff -ur Pyrex-0.9.3.orig/Pyrex/Compiler/Nodes.py Pyrex-0.9.3/Pyrex/Compiler/Nodes.py
--- Pyrex-0.9.3.orig/Pyrex/Compiler/Nodes.py	2004-07-11 09:26:29.000000000 +0200
+++ Pyrex-0.9.3/Pyrex/Compiler/Nodes.py	2005-06-16 22:51:58.000000000 +0200
@@ -484,9 +484,9 @@
         self.generate_self_cast(scope, code)
         type = scope.parent_type
         if type.vtabslot_cname:
-            code.putln("(struct %s *)p->%s = %s;" % (
-                type.vtabstruct_cname,
+            code.putln("p->%s = (struct %s *)%s;" % (
                 type.vtabslot_cname,
+                type.vtabstruct_cname,
                 type.vtabptr_cname))
         for entry in scope.var_entries:
             if entry.type.is_pyobject:
@@ -1685,10 +1685,11 @@
         code.putln("")
         if self.return_type.is_pyobject:
             if self.return_type.is_extension_type:
-                lhs = "(PyObject *)%s" % Naming.retval_cname
+                cast = "(PyObject *)"
             else:
-                lhs = Naming.retval_cname
-            code.put_init_to_py_none(lhs)
+                cast = None
+            lhs = Naming.retval_cname
+            code.put_init_to_py_none(cast, lhs)
         else:
             val = self.return_type.default_value
             if val:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]