This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients Neal.Norwitz, vstinner
Date 2013-03-16.13:34:15
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1363440856.09.0.381103302961.issue17430@psf.upfronthosting.co.za>
In-reply-to
Content
> The 2 JUMP_ABSOLUTEs should be optimized away since the code is equivalent to: if a and b and c: as in:

Oh, I misread this sentence. I read that you would like to replace "if a: if b:" with "if a and b:". But it can be optimized differently: the useless jump can be removed during the bytecode generation.

I implemented replace "if a: if b:" with "if a and b:" in astoptimizer:

https://bitbucket.org/haypo/astoptimizer/commits/195df21d1dc30a21d0330e84794186488f266c29#chg-astoptimizer/optimizer.py

I already implemented removal of useless jumps in my second project, registervm:

http://hg.python.org/sandbox/registervm/file/f720340910ea/Lib/registervm.py#l1756

Read this file to learn more about my registervm project:
http://hg.python.org/sandbox/registervm/file/tip/REGISTERVM.txt
History
Date User Action Args
2013-03-16 13:34:16vstinnersetrecipients: + vstinner, Neal.Norwitz
2013-03-16 13:34:16vstinnersetmessageid: <1363440856.09.0.381103302961.issue17430@psf.upfronthosting.co.za>
2013-03-16 13:34:16vstinnerlinkissue17430 messages
2013-03-16 13:34:15vstinnercreate