[Python-Dev] lnotab and the AST optimizer

Thomas Lee tom at vector-seven.com
Thu Jul 24 16:56:35 CEST 2008


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.

Cheers,
Tom


More information about the Python-Dev mailing list