[pypy-issue] [issue1134] [cpyext] wrap_inquirypred not implemented

Stefan Behnel tracker at bugs.pypy.org
Sat Apr 21 19:09:33 CEST 2012

New submission from Stefan Behnel <stefan_ml at behnel.de>:

I'm getting a crash trying to port lxml:

RPython traceback:
  File "interpreter_gateway.c", line 1396, in
  File "module_cpyext_slotdefs.c", line 2858, in wrap_inquirypred
Fatal RPython error: NotImplementedError

This happens while calling PyObject_IsTrue() on an extension type instance that
implements the __nonzero__ slot. The only reference to "wrap_inquirypred" that I
can find in the sources is in pypy/module/cpyext/slotdefs.py, where it is being
used to configure the slot:

UNSLOT("__nonzero__", nb_nonzero, slot_nb_nonzero, wrap_inquirypred,
       "x != 0"),

but the actual implementation is missing. CPython implements it like this:

static PyObject *
wrap_inquirypred(PyObject *self, PyObject *args, void *wrapped)
    inquiry func = (inquiry)wrapped;
    int res;

    if (!check_num_args(args, 0))
        return NULL;
    res = (*func)(self);
    if (res == -1 && PyErr_Occurred())
        return NULL;
    return PyBool_FromLong((long)res);

where inquiry is defined like this:

typedef int (*inquiry)(PyObject *);

messages: 4278
nosy: pypy-issue, sbehnel
priority: bug
status: unread
title: [cpyext] wrap_inquirypred not implemented

PyPy bug tracker <tracker at bugs.pypy.org>

More information about the pypy-issue mailing list