Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.5.2/3.6+ compatibility patch for async generator protocol change #1082

Closed
achimnol opened this issue Aug 15, 2016 · 3 comments
Closed
Labels

Comments

@achimnol
Copy link
Member

Long story short

Currently the code uses PY_35 flag to define async generators (__aiter__ and __anext__ methods). However, __aiter__ will be changed to a plain method instead of coroutine in the future Python versions starting from Python 3.5.2 (http://bugs.python.org/issue27243).
Though it will follow the standard deprecation process and the code would not break immediately with deprecation warnings, I think we should be aware of this issue.

Expected/Actual behaviour

In all places that define __aiter__ method, it should check also not only if the current version >= 3.5.0 but also 3.5.2.

if PY_35:
    @asyncio.coroutine
    def __aiter___(self):
        ...

    @asyncio.coroutine
    def __anext__(self):
        ...

should become:

if PY_350 or PY_351:  # may need to be cleaned up
    @asyncio.coroutine
    def __aiter___(self):
        return self

    @asyncio.coroutine
    def __anext__(self):
        ...
elif PY_352:
    def __aiter___(self):
        return self

    @asyncio.coroutine
    def __anext__(self):
        ...

Your environment

Python 3.5.2 on MacOS X.

@asvetlov
Copy link
Member

Good catch!

@asvetlov
Copy link
Member

Fixed by #1086

@lock
Copy link

lock bot commented Oct 29, 2019

This thread has been automatically locked since there has not been
any recent activity after it was closed. Please open a new issue for
related bugs.

If you feel like there's important points made in this discussion,
please include those exceprts into that new issue.

@lock lock bot added the outdated label Oct 29, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants