[Pyrex] Returning extension objects...
Brian Myers
tarkawebfoot at charter.net
Thu Dec 7 09:15:53 UTC 2006
Hi all,
Coming back to this project after about 6 month's absence. This
method is within an rdbms_decimalcontext object:
cdef rdbms_decimal setres(self, rdbms_decimal res):
cdef rdbms_decimal r
if res is None:
r = self.pyx_create_decimal()
else:
res.context = self
r = res
return r
This generates the following C code:
static struct __pyx_obj_8decimals_rdbms_decimal
*__pyx_f_8decimals_20rdbms_decimalcontext_setres(struct
__pyx_obj_8decimals_rdbms_decimalcontext *__pyx_v_self,struct
__pyx_obj_8decimals_rdbms_decimal *__pyx_v_res) {
struct __pyx_obj_8decimals_rdbms_decimal *__pyx_v_r;
struct __pyx_obj_8decimals_rdbms_decimal *__pyx_r;
int __pyx_1;
PyObject *__pyx_2 = 0;
Py_INCREF(__pyx_v_self);
Py_INCREF(__pyx_v_res);
__pyx_v_r = (void *)Py_None; Py_INCREF((PyObject *) __pyx_v_r);
/* "/Users/Shared/py_decNumber/decimals.pyx":166 */
__pyx_1 = ((PyObject *)__pyx_v_res) == Py_None;
if (__pyx_1) {
/* "/Users/Shared/py_decNumber/decimals.pyx":167 */
__pyx_2 = ((PyObject *)((struct
__pyx_vtabstruct_8decimals_rdbms_decimalcontext *)__pyx_v_self-
>__pyx_vtab)->pyx_create_decimal(__pyx_v_self)); if (!__pyx_2)
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; goto __pyx_L1;}
Py_DECREF(((PyObject *)__pyx_v_r));
__pyx_v_r = __pyx_2;
__pyx_2 = 0;
goto __pyx_L2;
}
/*else*/ {
/* "/Users/Shared/py_decNumber/decimals.pyx":169 */
Py_INCREF(((PyObject *)__pyx_v_self));
Py_DECREF(((PyObject *)__pyx_v_res->context));
((PyObject *)__pyx_v_res->context) = ((PyObject *)__pyx_v_self);
/* "/Users/Shared/py_decNumber/decimals.pyx":170 */
Py_INCREF(((PyObject *)__pyx_v_res));
Py_DECREF(((PyObject *)__pyx_v_r));
__pyx_v_r = ((PyObject *)__pyx_v_res);
}
__pyx_L2:;
/* "/Users/Shared/py_decNumber/decimals.pyx":171 */
Py_INCREF(((PyObject *)__pyx_v_r));
__pyx_r = (struct __pyx_obj_8decimals_rdbms_decimal *)((PyObject *)
__pyx_v_r);
goto __pyx_L0;
__pyx_r = (void *)Py_None; Py_INCREF((PyObject *) __pyx_r);
goto __pyx_L0;
__pyx_L1:;
Py_XDECREF(__pyx_2);
__Pyx_AddTraceback("decimals.rdbms_decimalcontext.setres");
__pyx_r = 0;
__pyx_L0:;
Py_DECREF(__pyx_v_r);
Py_DECREF(__pyx_v_self);
Py_DECREF(__pyx_v_res);
return ((struct __pyx_obj_8decimals_rdbms_decimal *)__pyx_r) ;
}
Generates the following warnings:
decimals.c: In function
'__pyx_f_8decimals_20rdbms_decimalcontext_setres':
decimals.c:530: warning: assignment from incompatible pointer type
decimals.c:539: warning: target of assignment not really an lvalue;
this will be a hard error in the future
decimals.c:544: warning: assignment from incompatible pointer type
I've bolded the statements that correspond to warnings. Are these
warnings common, or even a problem? Is the lvalue warning fixed in
pyrex 0.9.4.1? If so, any idea when the DarwinPorts maintainer might
get the update out?
Thanx,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.copyleft.no/pipermail/pyrex/attachments/20061207/84c80a7f/attachment.html
More information about the Pyrex
mailing list