[Python-Dev] Recent changes to PyCodeObject

Ned Batchelder ned at nedbatchelder.com
Wed Nov 16 19:18:16 EST 2016

When I added Python 3.6 support to coverage.py, I posted a Mac wheel to
PyPI: https://pypi.python.org/pypi/coverage/  That wheel was built
against 3.6a3, the latest version at the time.  When I use it now on
3.6b3, it doesn't work right.  The reason is that the co_firstlineno
field in PyCodeObject moved in September, as part of the PEP 523 work:

The docs say that PyCodeObject can change at any time, but I don't see
why the field had to move in the first place.  Was this needed?

Am I doing the wrong thing by using PyCodeObject fields directly in the
coverage.py C trace function?  It seems like this was an unnecessary
breaking change, even if it is a non-guaranteed interface.

BTW, there are some comments that should be updated based on that
commit, I can submit a patch to fix them.


More information about the Python-Dev mailing list