GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-93896: always set event loop in asyncio.run and IsolatedAsyncioTestCase by kumaraditya303 · Pull Request #94593 · python/cpython

Conversation

@kumaraditya303

@kumaraditya303 kumaraditya303 commented Jul 6, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor
  • Issue: IsolatedAsyncioTestCase and asyncio.run no-longer call asyncio.set_event_loop #93896

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@kumaraditya303
always set event loop
a67cc6f
@bedevere-bot bedevere-bot added the awaiting review label Jul 6, 2022
@kumaraditya303 kumaraditya303 self-assigned this Jul 6, 2022
graingert
graingert requested changes Jul 6, 2022
View reviewed changes
Comment thread Lib/asyncio/runners.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Jul 6, 2022
@kumaraditya303
kumaraditya303 force-pushed the asyncio-ev branch from f59b6eb to bd1eeb9 Compare July 6, 2022 06:19
graingert
graingert reviewed Jul 6, 2022
View reviewed changes
Comment thread Lib/unittest/async_case.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@blurb-it
📜🤖 Added by blurb_it.
9576a91
@kumaraditya303
kumaraditya303 force-pushed the asyncio-ev branch from bd1eeb9 to 9576a91 Compare July 6, 2022 06:35
graingert
graingert reviewed Jul 6, 2022
View reviewed changes
Comment thread Lib/asyncio/runners.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

graingert
graingert reviewed Jul 6, 2022
View reviewed changes
Comment thread Lib/unittest/async_case.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
wip
f3c1caf
@kumaraditya303
kumaraditya303 marked this pull request as ready for review July 6, 2022 07:47
@kumaraditya303
kumaraditya303 requested review from 1st1 and asvetlov as code owners July 6, 2022 07:47
@kumaraditya303 kumaraditya303 added release-blocker needs backport to 3.11 only security fixes labels Jul 6, 2022
@kumaraditya303 kumaraditya303 mentioned this pull request Jul 6, 2022
IsolatedAsyncioTestCase and asyncio.run no-longer call asyncio.set_event_loop #93896
Closed
graingert
graingert reviewed Jul 6, 2022
View reviewed changes
Comment thread Lib/asyncio/runners.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@graingert

graingert commented Jul 6, 2022

Copy link
Copy Markdown
Contributor

Can you copy over the test cases from my PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
add a test
d01fd01
@kumaraditya303

kumaraditya303 commented Jul 6, 2022

Copy link
Copy Markdown
Contributor Author

Can you copy over the test cases from my PR?

I added a test.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

asvetlov
asvetlov approved these changes Jul 6, 2022
View reviewed changes

@asvetlov asvetlov left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kumaraditya303 and ericsnowcurrently reacted with heart emoji
All reactions
  • ❤️ 2 reactions
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting core review labels Jul 6, 2022
@kumaraditya303

kumaraditya303 commented Jul 6, 2022

Copy link
Copy Markdown
Contributor Author

LGTM, thanks for the fix!

Thanks for the reviews!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
fix import
16be2ec
@graingert

graingert commented Jul 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

I think the docs should describe this change:


class Runner:
    """A context manager that controls event loop life cycle.
    The context manager always creates a new event loop,
    allows to run async functions inside it, sets the policy loop,
    and properly finalizes the loop at the context manager exit.
    If debug is True, the event loop will be run in debug mode.
    If loop_factory is passed, it is used for new event loop creation, however the
    policy loop will not be set
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303

kumaraditya303 commented Jul 6, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

I think the docs should describe this change:


class Runner:
    """A context manager that controls event loop life cycle.
    The context manager always creates a new event loop,
    allows to run async functions inside it, sets the policy loop,
    and properly finalizes the loop at the context manager exit.
    If debug is True, the event loop will be run in debug mode.
    If loop_factory is passed, it is used for new event loop creation, however the
    policy loop will not be set

This would complicate things for an average user about how policy registry works. The existing docs is clear If loop_factory is passed, it is used for new event loop creation. We can iterate over docs afterwards but let's fix the release blockers first.

asvetlov and graingert reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@kumaraditya303
kumaraditya303 requested a review from pablogsal July 6, 2022 09:44
@pablogsal
pablogsal merged commit 14fea6b into python:main Jul 6, 2022
@miss-islington

miss-islington commented Jul 6, 2022

Copy link
Copy Markdown
Contributor

Thanks @kumaraditya303 for the PR, and @pablogsal for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot removed awaiting merge needs backport to 3.11 only security fixes labels Jul 6, 2022
@bedevere-bot

bedevere-bot commented Jul 6, 2022

Copy link
Copy Markdown

GH-94608 is a backport of this pull request to the 3.11 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 6, 2022
@kumaraditya303 @miss-islington
pythonGH-93896: AAlways set event loop in asyncio.run and IsolatedAsy…
d347aa7
…ncioTestCase (pythonGH-94593)

(cherry picked from commit 14fea6b)

Co-authored-by: Kumar Aditya <[email protected]>
@kumaraditya303
kumaraditya303 deleted the asyncio-ev branch July 6, 2022 15:20
@graingert graingert mentioned this pull request Jul 6, 2022
gh-93896: allow enabling asyncio.Runner calls to asyncio.set_event_loop independantly to loop_factory #94058
Closed
miss-islington added a commit that referenced this pull request Jul 6, 2022
@miss-islington @kumaraditya303
GH-93896: AAlways set event loop in asyncio.run and IsolatedAsyncioTe…
0187b60
…stCase (GH-94593)

(cherry picked from commit 14fea6b)

Co-authored-by: Kumar Aditya <[email protected]>
@kumaraditya303 kumaraditya303 mentioned this pull request Jul 9, 2022
PidfdChildWatcher runs callbacks on the main thread eventloop and not the currently running loop #94182
Closed
@gvanrossum gvanrossum mentioned this pull request Aug 12, 2022
GH-95899: fix asyncio.Runner to call set_event_loop once #95900
Merged
@kumaraditya303 kumaraditya303 added the topic-asyncio label Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@graingert graingert graingert requested changes
@asvetlov asvetlov asvetlov approved these changes
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@pablogsal pablogsal Awaiting requested review from pablogsal

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@kumaraditya303 kumaraditya303

Labels

release-blocker topic-asyncio

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

6 participants

@kumaraditya303 @graingert @miss-islington @bedevere-bot @asvetlov @pablogsal
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.