On 7/21/20 5:04 PM, Gregory P. Smith wrote:
Given it is impossible for tools doing passive inspection of Python VM instances to execute code, co_linetable's exact format will be depended on just as co_lnotab was.  co_lnotab was only quasi-"officially" documented in the Python docs, it's spec lives in https://github.com/python/cpython/blob/master/Objects/lnotab_notes.txt (pointed to by a couple module's docs). The lnotab format "changed" once, in 3.6, an unsigned delta was changed to signed (but I don't believe anything beyond some experiments ever actually used negatives?).

Negatives definitely happen.  When I comment out the line in coverage.py that deals with negative deltas, 34 of my tests fail.

For example:

   a = (
        1
   )

With 3.8 compiles to:

      2           0 LOAD_CONST               0 (1)

      1           2 STORE_NAME               0 (a)
                  4 LOAD_CONST               1 (None)
                  6 RETURN_VALUE

With an lnotab of "02 ff".

When executed, this produces these trace events:

   call on line 1
   line on line 2
   line on line 1
   return on line 1

--Ned.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/CSMZXXEYISMTVDPTNOG4J65IZJ76OI2Y/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to