This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bug in asyncio.corotuines._format_coroutine
Type: behavior Stage: resolved
Components: asyncio Versions: Python 3.6, Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: Brett Rosen, berker.peksag, gvanrossum, vstinner, yselivanov
Priority: normal Keywords:

Created on 2015-12-28 16:58 by Brett Rosen, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (3)
msg257119 - (view) Author: Brett Rosen (Brett Rosen) * Date: 2015-12-28 16:58
When running some test cases via py.test and using a coroutine created inside of cythonized code, I get the following:

   def _format_coroutine(coro):
        assert iscoroutine(coro)
        coro_name = getattr(coro, '__qualname__', coro.__name__)
    
        filename = coro.gi_code.co_filename
        if (isinstance(coro, CoroWrapper)
        and not inspect.isgeneratorfunction(coro.func)):
>           filename, lineno = events._get_function_source(coro.func)
E           TypeError: 'NoneType' object is not iterable


This appears to be because this line:

https://github.com/python/asyncio/blob/2a19f9329f4ee710fef7728b316aa4fe1d07dbef/asyncio/coroutines.py#L289

Is expecting to get back two values, but because of:

https://github.com/python/asyncio/blob/master/asyncio/events.py#L35

This it only gets back None.


> /usr/local/lib/python3.4/asyncio/events.py(25)_get_function_source()
-> if _PY34:
(Pdb) func
<cyfunction ProgressTracker._do_report at 0x7fdd2fc46498>
msg257565 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2016-01-05 23:57
Thanks! I've fixed this in the git repo now (https://github.com/python/asyncio/commit/0c3e6ec0340f45d5f6989391358d44b8e974858e). It will be merged into the CPython repo at the next opportunity (before 3.5.2).
msg271202 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-07-25 01:45
Merged in f4fe55dd5659.
History
Date User Action Args
2022-04-11 14:58:25adminsetgithub: 70154
2016-07-25 01:45:10berker.peksagsetstatus: open -> closed

type: behavior
versions: + Python 3.5, Python 3.6
nosy: + berker.peksag

messages: + msg271202
stage: resolved
2016-01-05 23:57:50gvanrossumsetassignee: gvanrossum
resolution: fixed
2016-01-05 23:57:36gvanrossumsetmessages: + msg257565
2015-12-28 16:58:36Brett Rosencreate