[Pyrex] c++ patch usage

Szabolcs Nagy nszabolcs at gmail.com
Thu Feb 2 19:41:02 CET 2006


Hello
Thanks for the reply, I edited Pyrex/Distutils/build_ext.py.
It works now, but the patch breaks one of my old pyrex code.

# test.pyx:
cdef class A: pass
cdef A newA(): return A()

The error message is:
test.cpp: In function '__pyx_obj_8test_A* __pyx_f_8test_newA()':
test.cpp:69: error: invalid conversion from 'void*' to '__pyx_obj_8test_A*'

The generated test.cpp (67-69):
67  goto __pyx_L0;
68
69  __pyx_r = (void *)Py_None; Py_INCREF((PyObject *) __pyx_r);

Solution:
1. Generate (return_type *) instead of (void *)
2. This is a cdef function. Is it allowed to return None here? (eg. in
this case line 69 won't be executed) Is there a situation when that
line is needed?


nsz



More information about the Pyrex mailing list