[New-bugs-announce] [issue24316] Fix types.coroutine to accept objects from Cython

Yury Selivanov report at bugs.python.org
Thu May 28 18:31:52 CEST 2015


New submission from Yury Selivanov:

Stefan,

This patch should solve the problem with types.coroutine accepting only pure python generator functions.

The approach is, however, slightly different from what you've proposed.  Instead of having a wrapper class (delegating .throw, .send etc to a wrapped object), we now simply check if the returned value of the wrapped function is an instance of collections.abc.Coroutine.  Issue 24315 enables duck typing for coroutines, so if a cython-based coroutine implements all coroutine abstract methods, it will automatically pass types.coroutine.

----------
assignee: yselivanov
components: Library (Lib)
files: coroutine.patch
keywords: patch
messages: 244315
nosy: gvanrossum, ncoghlan, scoder, yselivanov
priority: normal
severity: normal
stage: patch review
status: open
title: Fix types.coroutine to accept objects from Cython
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file39536/coroutine.patch

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


More information about the New-bugs-announce mailing list