PEP 626: Allow zero-width entries in code.co_lines(), to allow better bytecode generation. (#1743)

This commit is contained in:
Mark Shannon 2020-12-22 13:54:47 +00:00 committed by GitHub
parent 6ae684738d
commit 4e5abc4ca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -166,13 +166,20 @@ each representing the line number of a range of bytecodes. Each tuple will consi
The sequence generated will have the following properties:
* The first range in the sequence with have a ``start`` of ``0``
* The ``(start, end)`` ranges will be strictly increasing and consecutive.
* The ``(start, end)`` ranges will be non-decreasing and consecutive.
That is, for any pair of tuples the ``start`` of the second
will equal to the ``end`` of the first.
* No range will be empty, that is ``end`` > ``start`` for all triples.
* No range will be backwards, that is ``end >= start`` for all triples.
* The final range in the sequence with have ``end`` equal to the size of the bytecode.
* ``line`` will either be a positive integer, or ``None``
Zero width ranges
-----------------
Zero width range, that is ranges where ``start == end`` are allowed.
Zero width ranges are used for lines that are present in the source code,
but have been eliminated by the bytecode compiler.
The co_linetable attribute
''''''''''''''''''''''''''