[Python-Dev] lnotab and the AST optimizer

Phillip J. Eby pje at telecommunity.com
Thu Jul 24 18:34:26 CEST 2008

At 12:56 AM 7/25/2008 +1000, Thomas Lee wrote:
>I'm making some good progress with the AST optimizer, and now the 
>main thing standing in my way is lnotab. Currently lnotab expects 
>bytecode sequencing to be roughly in-sync with the order of the 
>source file and a few things that the optimizer does (e.g. swapping 
>the bodies of an if/else after removing negation such that "if not 
>X: A; else: B" becomes "if X: B; else A") breaks this assumption. 
>This will result in either an assertion failure or incorrect line 
>numbers being reported.
>It seems that lnotab is used in relatively few places in the source 
>code at the moment, but if I'm going to make a change to how lnotab 
>works I want to do so in a way that's going to allow me to move 
>forward while keeping everybody happy.
>I'm away for a few days so I probably won't be able to get back to 
>anybody until either Sunday or Monday, but I'd appreciate it if 
>anybody in the know can weigh in on this.

I'd personally love it if the lnotab were capable of handling line 
numbers from different files as well as out-of-order lines.  (For 
function inlining, among other more esoteric things.)

More information about the Python-Dev mailing list