[issue21209] q.put(some_tuple) fails when PYTHONASYNCIODEBUG=1

STINNER Victor report at bugs.python.org
Mon Apr 14 05:00:25 CEST 2014


STINNER Victor added the comment:

I don't think that the bug comes from asyncio, but it looks like a bug in the implementation of "yield from" in CPython directly! Try with ceval.patch.

ceval.c has a fast path if the object is a generator. With PYTHONASYNCIODEBUG=1, the object is a CoroWrapper, not a generator. In this case, the slow path is used:

   retval = _PyObject_CallMethodId(reciever, &PyId_send, "O", v);

This line comes from the initial commit introducing yield-from:
---
changeset:   74356:d64ac9ab4cd0
user:        Nick Coghlan <ncoghlan at gmail.com>
date:        Fri Jan 13 21:43:40 2012 +1000
files:       Doc/library/dis.rst Doc/library/exceptions.rst Doc/reference/expressions.rst Doc/reference/simple_stmts.rst Doc/whatsnew/3.
description:
Implement PEP 380 - 'yield from' (closes #11682)
---
(The exact line changed and the line was moved, but "O" format didn't change.)

Still no unit test, I'm too tired to write one, and I'm not sure that it's a bug in ceval.c.

----------
nosy: +ncoghlan
Added file: http://bugs.python.org/file34813/ceval.patch

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


More information about the Python-bugs-list mailing list