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 _doublep
Recipients _doublep, belopolsky, gvanrossum, nnorwitz
Date 2008-02-25.20:25:49
SpamBayes Score 0.010196546
Marked as misclassified No
Message-id <1203971150.9.0.438092788506.issue1394@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, help with unit tests would be appreciated.  Especially since it is
not supposed to fix anything, so I'm not sure what unit tests should be
like...

BTW, trying to understand why the patch didn't remove unreachable code
in your first example, I noticed this (both cases are with patch):

def f1():
    return 1
    x()

disassembly:
  3           0 LOAD_CONST               1 (1)
              3 RETURN_VALUE

  4           4 LOAD_GLOBAL              0 (x)
              7 CALL_FUNCTION            0
             10 POP_TOP

def f2():
    return 1
    x()
    return 2

disassembly:
  3           0 LOAD_CONST               1 (1)
              3 RETURN_VALUE

Looking a bit further, I noticed this:
	if (codestr[codelen-1] != RETURN_VALUE)
		goto exitUnchanged;

So, the patch really can't help with your first example, because peephol
optimizer just bails out before real action begins.
History
Date User Action Args
2008-02-25 20:25:51_doublepsetspambayes_score: 0.0101965 -> 0.010196546
recipients: + _doublep, gvanrossum, nnorwitz, belopolsky
2008-02-25 20:25:50_doublepsetspambayes_score: 0.0101965 -> 0.0101965
messageid: <1203971150.9.0.438092788506.issue1394@psf.upfronthosting.co.za>
2008-02-25 20:25:49_doubleplinkissue1394 messages
2008-02-25 20:25:49_doublepcreate