Message281591
Oh wow, the bug is tricky.
_PyGen_yf() checks if the next instruction is YIELD_FROM using code[f_lasti+2]. The problem is that WORDCODE kept f_lasti == -1 for a frame not executed yet: f_lasti+2 is 1 in this case.
Problem: code[1] is not an operation code, but the argment. Python 3.6 bytecode now uses the "wordcode" format: 16-bit units of (operation, argument).
The obvious and simple fix is to add a special case for f_lasti==-1 in _PyGen_yf(): see attached patch.
pygen_yf.patch fixes the crash.
--
Another much larger change would be to change f_lasti to -2... In the rewiew of the huge WORDCODE patch, if I recall correctly, I asked Demur to use -1 for backward compatibility. Or maybe I asked to kept the backward compatibility at the Python level using a getter converting -2 to -1... I don't recall correctly.
See http://bugs.python.org/issue26647 for wordcode. |
|
Date |
User |
Action |
Args |
2016-11-23 23:11:25 | vstinner | set | recipients:
+ vstinner, ned.deily, r.david.murray, serhiy.storchaka, yselivanov, martius |
2016-11-23 23:11:25 | vstinner | set | messageid: <1479942685.52.0.69692262522.issue28782@psf.upfronthosting.co.za> |
2016-11-23 23:11:25 | vstinner | link | issue28782 messages |
2016-11-23 23:11:25 | vstinner | create | |
|