Armin Rigo added the comment: (C3) _PyGen_yf() checks the opcode at [f_lasti + 1], which is the next opcode that will run when we resume the generator: either it is the opcode following the YIELD, or it is exactly YIELD_FROM. It is not possible at the moment to write Python code that compiles to a YIELD immediately followed by YIELD_FROM, so by chance the two cases are correctly distinguished. *However,* the discussion so far assumes that the generator is not currently running. If it is (which probably doesn't occur in reasonable Python code but can be constructed manually), then this checks for example the byte/word that describes the argument of the currently running opcode. If we're very unlucky this byte has the value 72, which is YIELD_FROM. Total nonsense and crashes follow.
---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28883> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com