Understanding co_lnotab

Ned Batchelder ned at nedbatchelder.com
Sat Sep 27 08:08:58 EDT 2014


On 9/26/14 7:13 AM, Shiyao Ma wrote:
> When reading the notes on co_lnotab
> 
> I totally got lost at this
> line:https://hg.python.org/cpython/file/fd0c02c3df31/Objects/lnotab_notes.txt#l31
> 
> It says,"In case #b, there's no way to know
>   from looking at the table later how many were written."
> 
> 
> No way to know "what" is written?
> And why no way to know "how many" times?
> 

I'm not sure what that sentence means, and I've written code that uses
co_lnotab.  I think they are trying to explain the difficulties with
abandoned approaches.  Don't worry about that.  Look at the code in the
comment there to see how to interpret the bytes in co_lnotab.

Here's the code in coverage.py that reads it:
https://bitbucket.org/ned/coveragepy/src/a69ae93817be94e400df257e1b1e41cf37c9b146/coverage/parser.py?at=default#cl-377
if that helps.

Just out of curiosity, what are you writing, it sounds interesting! :)

--Ned.

> 
> Regards
> 
> 


-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list