Amaury Forgeot d'Arc <[email protected]> added the comment:

Thanks for the test, but I think it has two caveats:

- space.unwrap() cannot return a number, since the result is some numpy 
instance. You could use 
space.eq_w(w_result, space.wrap(2)) instead.

- api.PyObject_GetItem() does not try to convert the value to a PyObject* 
pointer; it only manipulates w_objects, 
so the initial issue is not reproduced here; try to use make_ref() on the result

Or don't use PyObject_GetItem at all: it's not part of the problem!
Only make_ref() of a numpy.int64(2) object.

Maybe something like:

w_obj = space.appexec([], """():
    import numpypy as np
    return np.int64(2)""")
ref = make_ref(space, w_obj)
api.Py_DecRef(ref)

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1621>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to