Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1#111368

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
iritkatriel wants to merge23 commits intopython:mainfromiritkatriel:gen_close

Conversation

iritkatriel
Copy link
Member

@iritkatrieliritkatriel commentedOct 26, 2023
edited
Loading

gen_close needs to know whether aRESUME follows aYIELD_VALUE which is at except-depth 1, for an important optimization. Currently the compiler stores this information in the oparg ofYIELD_VALUE, which requiresgen_close to peek into the bytecode (which is unsafe in the debugger). This PR puts this information in the oparg of theRESUME, and removes the oparg ofYIELD_VALUE. The result is simpler and safer code in gen_close.

It also removes an anomaly in the bytecode definitions, where we needed to add a meaningless assertion to make the code generator understand that YIELD_VALUE has an oparg even though it doesn't use it.


📚 Documentation preview 📚:https://cpython-previews--111368.org.readthedocs.build/

@brettcannonbrettcannon removed their request for reviewOctober 26, 2023 17:51
iritkatrieland others added17 commitsOctober 26, 2023 18:56
…thon#110884)- `ThreadedChildWatcher.close()` is now *officially* a no-op; `_join_threads()` never did anything.- Threads created by that class are now named `asyncio-waitpid-NNN`.- `test.test_asyncio.utils.TestCase.close_loop()` now waits for the child watcher's threads, but not forever; if a thread hangs, it raises `RuntimeError`.
* Include Python version in cache.config key, after Python setup* Remove EOL 3.7 from branch triggers
…GH-111336)* Try to fix asyncio.Server.wait_closed() againI identified the condition that `wait_closed()` is intendedto wait for: the server is closed *and* there are no moreactive connections.When this condition first becomes true, `_wakeup()` is called(either from `close()` or from `_detach()`) and it sets `_waiters`to `None`. So we just check for `self._waiters is None`; if it'snot `None`, we know we have to wait, and do so.A problem was that the new test introduced in 3.12 explicitlytested that `wait_closed()` returns immediately when the serveris *not* closed but there are currently no active connections.This was a mistake (probably a misunderstanding of the intendedsemantics). I've fixed the test, and added a separate test thatchecks exactly for this scenario.I also fixed an oddity where in `_wakeup()` the result of thewaiter was set to the waiter itself. This result is not usedanywhere and I changed this to `None`, to avoid a GC cycle.* Update Lib/asyncio/base_events.py---------Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
@ghost
Copy link

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrentlyericsnowcurrently is a code owner

@ncoghlanncoghlanAwaiting requested review from ncoghlanncoghlan is a code owner

@warsawwarsawAwaiting requested review from warsawwarsaw is a code owner

@markshannonmarkshannonAwaiting requested review from markshannonmarkshannon is a code owner

@barneygalebarneygaleAwaiting requested review from barneygalebarneygale is a code owner

@1st11st1Awaiting requested review from 1st11st1 is a code owner

@asvetlovasvetlovAwaiting requested review from asvetlovasvetlov is a code owner

@gvanrossumgvanrossumAwaiting requested review from gvanrossum

@kumaraditya303kumaraditya303Awaiting requested review from kumaraditya303kumaraditya303 is a code owner

@willingcwillingcAwaiting requested review from willingcwillingc is a code owner

@ezio-melottiezio-melottiAwaiting requested review from ezio-melottiezio-melotti is a code owner

@hugovkhugovkAwaiting requested review from hugovkhugovk is a code owner

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

13 participants
@iritkatriel@jonathanberthias@zmc@vstinner@gaogaotiantian@gvanrossum@skirpichev@hugovk@barneygale@sobolevn@c-bata@dimaqq@ekohilas

[8]ページ先頭

©2009-2025 Movatter.jp