2012/4/3 Stefan Behnel <stefan...@behnel.de>: > The basic C code that gets executed in the test_append() function is simply > > PyObject* m = PyObject_GetAttrString(L, "append"); > r = PyObject_CallFunctionObjArgs(m, x, NULL); > > And that's where the error gets raised (returning r==NULL). Specifically, > it does not enter into the actual append() method but fails before that, > right at the call.
The issue is with CyFunctionType, which looks like a subclass of PyCFunction_Type. (it's a hack: normally this type is not subclassable, booo) L.append is such a CyFunctionType. Its tp_call slot is called, but this is defined to __Pyx_PyCFunction_Call which is #defined to PyObject_Call, which itself invokes the tp_call slot... A solution would be to access the "base" tp_call, the one that CPython exposes as PyCFunction_Call. Unfortunately cpyext only defines one tp_call shared by all types, one which simply delegates to self.__call__. This means that "calling the base slot" does not work very well with cpyext. There is a solution though, which I implemented a long time ago for the tp_setattro slot. It can be easily expanded to it's a hack: normally this type is not subclassable, booo) all slots but I'm a bit scared of the explosion of code this could generate. -- Amaury Forgeot d'Arc _______________________________________________ pypy-dev mailing list pypy-dev@python.org http://mail.python.org/mailman/listinfo/pypy-dev