◐ Shell
reader mode source ↗
Skip to content

bpo-43751: Fix anext() bug where it erroneously returned None#25238

Merged
pablogsal merged 16 commits into
python:masterfrom
sweeneyde:fix_anext
Apr 11, 2021
Merged

bpo-43751: Fix anext() bug where it erroneously returned None#25238
pablogsal merged 16 commits into
python:masterfrom
sweeneyde:fix_anext

Conversation

@sweeneyde

@sweeneyde sweeneyde commented Apr 7, 2021

Copy link
Copy Markdown
Member

@pablogsal

Copy link
Copy Markdown
Member

There are a bunch of problems in the CI. The main one is:

======================================================================
ERROR: test_async_gen_anext (test.test_asyncgen.AsyncGenAsyncioTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/cpython/cpython/Lib/test/test_asyncgen.py", line 401, in test_async_gen_anext
    res = self.loop.run_until_complete(consume())
  File "/Users/runner/work/cpython/cpython/Lib/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/Users/runner/work/cpython/cpython/Lib/test/test_asyncgen.py", line 399, in consume
    results.append(await anext(g, 'buckle my shoe'))
TypeError: anext() argument was not async iterable.

----------------------------------------------------------------------

and there is also some trailing whitespace. Could you check these?

@sweeneyde

Copy link
Copy Markdown
Member Author

This should probably have been a draft PR. I wrote a test for the erroneous None returns, then fixed it. And then I applied the same test to async iterables that are not generators, and that is still failing.

@sweeneyde

Copy link
Copy Markdown
Member Author

This should be ready for review now.

@pablogsal pablogsal requested review from 1st1 and gvanrossum April 8, 2021 23:55

@jab jab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hide comment

Thanks for catching this!

@gvanrossum

Copy link
Copy Markdown
Member

Side comment on the PR title: please don't use "should no longer". Say something like "Fix anext() bug where it erroneously returned None".

Fix inconsistent variable names in comment

Co-authored-by: Joshua Bronson <jabronson@gmail.com>
@sweeneyde sweeneyde changed the title bpo-43751: anext() should no longer erroneously return None. Apr 9, 2021
@gvanrossum

Copy link
Copy Markdown
Member

I'm requesting that someone else reviews this instead of me. @pablogsal? @1st1?

…use awaitable is always a coroutine in that case.
@sweeneyde

Copy link
Copy Markdown
Member Author

./python -m test test_asyncgen -R3:3 now passes

@pablogsal

Copy link
Copy Markdown
Member

Thanks for the PR @sweeneyde

@sweeneyde sweeneyde deleted the fix_anext branch December 19, 2021 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants