[issue28782] SEGFAULT when running a given coroutine

STINNER Victor report at bugs.python.org
Thu Nov 24 09:25:29 EST 2016


STINNER Victor added the comment:

Updated patch. I added a NEWS entry and the two assertions from  lasti.patch. These assertions are basic sanity checks, not directly related to this issue, they shouldn't harm. A started frame must never go back to the not-started state (f_lasti < 0).

Yury: "How about we commit pygen_yf.patch to 3.6 and whatever else in 3.7?"

Wordcode is already a massive change in our bytecode, I would prefer to not touch f_lasti just as a late update of WORDCODE in 3.7.

I'm ok to keep f_lasti == -1 for frames not started yet.


Serhiy: "I prefer pygen_yf.patch (with addressing Yury's suggestions)."

Ok, fine. I'm also more confident in smaller changes when we are very close to the final release! So let's forget lasti.patch ;-) (Sorry Demur!)

--

FYI attached test.py reproduces the bug because Cursor._read_data() starts with the instruction  "SETUP_LOOP 72" and 72 is the code of the operation YIELD_FROM :-)

To reproduce the bug, you must have a code object where the second byte is 72. It's not easy to control the generated bytecode from the Python code, so I decided to not write an unit test for this bug.

----------
Added file: http://bugs.python.org/file45625/pygen_yf-2.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28782>
_______________________________________


More information about the Python-bugs-list mailing list