[Pyrex] PyArg_ParseTuple error "new style getargs ..."

Drew Perttula drewp at bigasterisk.com
Sun Nov 13 07:55:23 CET 2005


pyrex 0.9.3.1; python 2.3.4.

It looks like an error in ParseTuple is getting reported in a later
line PyErr_Occurred line. This might be a cpython bug.

The SystemError seems to always occur on the first PyErr_Occurred
test, even if that line is quite innocent like in my example
below. Unfortunately, I cannot post the full source of my test.




  File "file.pyx", line 48, in func
    xx = int(3)
SystemError: new style getargs format but argument is not a tuple


from file.c:
    
static PyObject *__pyx_f_11func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_11func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  struct __pyx_obj_11foo *__pyx_v_bar = 0;
  PyObject *__pyx_v_bazz = 0;
  int __pyx_v_xx;
  PyObject *__pyx_v_x;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  static char *__pyx_argnames[] = {"bar","bazz",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_bar, &__pyx_v_bazz)) return 0;
  Py_INCREF(__pyx_v_bar);
  Py_INCREF(__pyx_v_bazz);
  __pyx_v_x = Py_None; Py_INCREF(__pyx_v_x);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bar), __pyx_ptype_11type1, 1, "bar")) {__pyx_filename = __pyx_f[0]; __pyx
_lineno = 46; goto __pyx_L1;}

  /* "file.pyx":48 */
  __pyx_1 = __Pyx_GetName(__pyx_b, "int"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_xx = __pyx_4;



from file.pyx:
    
def func(type1 bar, bazz):
    cdef int xx
    xx = int(3)




More information about the Pyrex mailing list