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 nnorwitz
Recipients nnorwitz
Date 2008-02-25.02:00:12
SpamBayes Score 0.008943157
Marked as misclassified No
Message-id <1203904814.51.0.0269762586023.issue2181@psf.upfronthosting.co.za>
In-reply-to
Content
This patch optimizes code like:

   x = any_expression
   return x

to:
   return any_expression

Currently it only optimizes out the local variable if there is a return
because it can't determine if this is the last use of the variable or not.

This shouldn't change behaviour under normal circumstances, but would
change behaviour with a debugger.  Perhaps this optimization should only
be performed if -O is passed on the command line?

This optimization saves two trips around the eval loop (STORE_FAST and
LOAD_FAST) and 6 bytes in the byte code.
History
Date User Action Args
2008-02-25 02:00:14nnorwitzsetspambayes_score: 0.00894316 -> 0.008943157
recipients: + nnorwitz
2008-02-25 02:00:14nnorwitzsetspambayes_score: 0.00894316 -> 0.00894316
messageid: <1203904814.51.0.0269762586023.issue2181@psf.upfronthosting.co.za>
2008-02-25 02:00:13nnorwitzlinkissue2181 messages
2008-02-25 02:00:13nnorwitzcreate