Paul Pogonyshev added the comment: 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. __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1394> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com