Hi Dmitry,

those fields are quite implementation-dependant, it's not clear to me
that their use can be just carried over from CPython in all cases. Could
you maybe tell us which exception module uses them or at least what you
are doing with them? But yes, as Armin write, accessing the the .co_*
attributes with PyObject_GetAttrString is an approach!

Cheers,

CF

On 10.02.22 07:01, Dmitry Kovner wrote:
Hello! I'm trying to build a low-level C API extension of cPython to be
used in PyPy. The extension extensively uses some fields of PyCodeObject
(https://github.com/python/cpython/blob/f87e616af038ee8963185e11b96841c81e8ef15a/Include/code.h#L23
<https://github.com/python/cpython/blob/f87e616af038ee8963185e11b96841c81e8ef15a/Include/code.h#L23>):
 co_firstlineno, co_stacksize, co_consts
and so on. However, it seems these fields are not defined in the similar
structure of the PyPy  implementation:
https://foss.heptapod.net/pypy/pypy/-/blob/branch/py3.8/pypy/module/cpyext/include/code.h#L7
<https://foss.heptapod.net/pypy/pypy/-/blob/branch/py3.8/pypy/module/cpyext/include/code.h#L7>.
Is it possible to get values of these fields using PyPy C API somehow?

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

_______________________________________________
pypy-dev mailing list
pypy-dev@python.org
https://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to