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.

作者 _doublep
收信人 _doublep, belopolsky, gvanrossum, nnorwitz
日期 2008-02-25.20:25:49
SpamBayes Score 0.010196546
Marked as misclassified
Message-id <1203971150.9.0.438092788506.issue1394@psf.upfronthosting.co.za>
In-reply-to
内容
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.
历史
日期 用户 动作 参数
2008-02-25 20:25:51_doublep修改spambayes_score: 0.0101965 -> 0.010196546
recipients: + _doublep, gvanrossum, nnorwitz, belopolsky
2008-02-25 20:25:50_doublep修改spambayes_score: 0.0101965 -> 0.0101965
messageid: <1203971150.9.0.438092788506.issue1394@psf.upfronthosting.co.za>
2008-02-25 20:25:49_doublep链接issue1394 messages
2008-02-25 20:25:49_doublep创建