[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 7356f71fb0a4 by Yury Selivanov in branch '3.5': Issue 24316: Fix types.coroutine() to accept objects from Cython https://hg.python.org/cpython/rev/7356f71fb0a4 New changeset 748c55375225 by Yury Selivanov in branch 'default': Issue 24316: Fix

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: I just noticed that I hadn't used the real types.coroutine in my Py3.5 tests when reporting back in issue 24017. When I pass a Cython generator through it, I get Traceback (most recent call last): File tests/run/test_coroutines_pep492.pyx, line 245, in

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: One failing test in test_coroutines: test_func_5. The reason is that the GeneratorWrapper is not iterable (and there is no reason it shouldn't be, given that it wraps a Generator). That was my fault, I had already added an __iter__ method but didn't copy it in

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: BTW, it's not only for compiled generators but also for normal Python functions that construct Python generators internally and return them, or that delegate the generator creation in some way. With this change, it's enough to decorate the constructor function

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Please test the attached patch. BTW, it's not only for compiled generators but also for normal Python functions that construct Python generators internally and return them You're right, that's why I used primarily word in that comment ;) types.coroutine()

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- resolution: fixed - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Updated patch. Wrapper now proxies gi_code, gi_running and gi_frame -- Added file: http://bugs.python.org/file39555/types_coroutine.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 8080b53342e8 by Yury Selivanov in branch '3.5': Issue 24316: Wrap gen objects returned from callables in types.coroutine https://hg.python.org/cpython/rev/8080b53342e8 New changeset c0434ef75177 by Yury Selivanov in branch 'default': Issue 24316:

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: Ok, now the problem with *this* patch is that __iter__ and __await__ are special methods that are being looked up on the type, not the instance. Similarly __next__, I think, as it also has its own (type) slot. But I think you're right that __next__ is also

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: I'm attaching a patch that works for me. Looks like we were working in parallel ;) I've incorporated your changes. Please look at the new patch (hopefully this one is final) -- Added file: http://bugs.python.org/file39557/types_coroutine.patch

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Stefan Behnel
Stefan Behnel added the comment: Your latest patch works for me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___ ___ Python-bugs-list

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Committed. Thanks, Stefan! -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-29 Thread Yury Selivanov
Yury Selivanov added the comment: Stefan, please take a look at this issue #24325 too. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-28 Thread Yury Selivanov
Changes by Yury Selivanov yseliva...@gmail.com: -- dependencies: +collections.abc: Coroutine should be derived from Awaitable ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24316 ___

[issue24316] Fix types.coroutine to accept objects from Cython

2015-05-28 Thread Yury Selivanov
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