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-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 by iritkatriel · Pull Request #111368 · python/cpython

Conversation

@iritkatriel

@iritkatriel iritkatriel commented Oct 26, 2023 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

gen_close needs to know whether a RESUME follows a YIELD_VALUE which is at except-depth 1, for an important optimization. Currently the compiler stores this information in the oparg of YIELD_VALUE, which requires gen_close to peek into the bytecode (which is unsafe in the debugger). This PR puts this information in the oparg of the RESUME, and removes the oparg of YIELD_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.

  • Issue: remove hacks in genobject.c #111354

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

Sorry, something went wrong.

Uh oh!

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

All reactions
iritkatriel added 3 commits October 26, 2023 17:16
@iritkatriel
use RESUME oparg to store exception depth info
03335e6
@iritkatriel
remove the arg from YIELD_VALUE
8b4e89d
@iritkatriel
add docs
84fbfc3
@iritkatriel
iritkatriel requested review from brettcannon, ericsnowcurrently, markshannon, ncoghlan and warsaw as code owners October 26, 2023 17:05
@bedevere-app bedevere-app Bot mentioned this pull request Oct 26, 2023
remove hacks in genobject.c #111354
Closed
@bedevere-app bedevere-app Bot added the awaiting core review label Oct 26, 2023
iritkatriel added 2 commits October 26, 2023 18:42
@iritkatriel
fix test_dis
3a111ab
@iritkatriel
add news
6005db5
@brettcannon
brettcannon removed their request for review October 26, 2023 17:51
iritkatriel and others added 17 commits October 26, 2023 18:56
@iritkatriel
regen-all
00a0cef
@iritkatriel
Merge branch 'main' into gen_close
50e2d25
@iritkatriel
regen-all
59b3cce
@iritkatriel
Merge branch 'main' into gen_close
dd8af2d
@jonathanberthias @iritkatriel
Fix typos in import system docs (python#111396)
c4b4583
@zmc @iritkatriel
pythongh-111406: Fix broken link to bpython's site (python#111407)
c48ec85
@vstinner @iritkatriel
pythongh-108765: Include explicitly <unistd.h> in signalmodule.c (pyt…
64ca0a9
…hon#111402)

unistd.h is needed by alarm() and pause() functions.
@gaogaotiantian @iritkatriel
pythongh-59013: Make line number of function breakpoint more precise (p…
3aeffca
…ython#110582)
@gvanrossum @iritkatriel
pythongh-110205: Fix asyncio ThreadedChildWatcher._join_threads() (py…
2e74589
…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`.
@skirpichev @iritkatriel
pythongh-111342: fix typo in math.sumprod (pythonGH-111416)
1b70f83
@hugovk @iritkatriel
CI: Include Python version in cache.config key (python#111410)
b632fc1
* Include Python version in cache.config key, after Python setup

* Remove EOL 3.7 from branch triggers
@gvanrossum @willingc @iritkatriel
pythongh-79033: Try to fix asyncio.Server.wait_closed() again (python…
c483c69
…GH-111336)

* Try to fix asyncio.Server.wait_closed() again

I identified the condition that `wait_closed()` is intended
to wait for: the server is closed *and* there are no more
active 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's
not `None`, we know we have to wait, and do so.

A problem was that the new test introduced in 3.12 explicitly
tested that `wait_closed()` returns immediately when the server
is *not* closed but there are currently no active connections.
This was a mistake (probably a misunderstanding of the intended
semantics). I've fixed the test, and added a separate test that
checks exactly for this scenario.

I also fixed an oddity where in `_wakeup()` the result of the
waiter was set to the waiter itself. This result is not used
anywhere and I changed this to `None`, to avoid a GC cycle.

* Update Lib/asyncio/base_events.py

---------

Co-authored-by: Carol Willing <[email protected]>
@barneygale @iritkatriel
pythonGH-110109: Move tests for pathlib.Path.walk() into main test …
5c9882e
…classes. (python#110655)
@sobolevn @iritkatriel
pythongh-111426: Remove test_cmd.test_coverage (python#111427)
d5ec031
@c-bata @iritkatriel
pythongh-66425: Remove the unreachable code to set REMOTE_HOST head…
31a9dcf
…er (pythongh-111441)
@dimaqq @iritkatriel
pythongh-111062: Separate macOS build into a reusable workflow (pytho…
8d5134b
…ngh-111444)
@ekohilas @iritkatriel
pythongh-94808: Add coverage test for number check (pythongh-111445)
f2fc8ee
@dimaqq @iritkatriel
pythongh-111062: Build both default and free-threaded on macOS (pytho…
5499901
…ngh-111449)
@iritkatriel
iritkatriel requested review from 1st1, asvetlov, barneygale, ezio-melotti, gvanrossum, hugovk, kumaraditya303 and willingc as code owners October 29, 2023 13:20
@ghost

ghost commented Oct 29, 2023

Copy link
Copy Markdown

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

  • [email protected]

Click the button to sign:
CLA not signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@iritkatriel iritkatriel closed this Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ncoghlan ncoghlan Awaiting requested review from ncoghlan ncoghlan is a code owner
@warsaw warsaw Awaiting requested review from warsaw warsaw is a code owner
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@barneygale barneygale Awaiting requested review from barneygale
@1st1 1st1 Awaiting requested review from 1st1 1st1 is a code owner
@asvetlov asvetlov Awaiting requested review from asvetlov asvetlov is a code owner
@gvanrossum gvanrossum Awaiting requested review from gvanrossum
@kumaraditya303 kumaraditya303 Awaiting requested review from kumaraditya303 kumaraditya303 is a code owner
@willingc willingc Awaiting requested review from willingc willingc is a code owner
@ezio-melotti ezio-melotti Awaiting requested review from ezio-melotti ezio-melotti is a code owner
@hugovk hugovk Awaiting requested review from hugovk hugovk is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

awaiting core review

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.

13 participants

@iritkatriel @jonathanberthias @zmc @vstinner @gaogaotiantian @gvanrossum @skirpichev @hugovk @barneygale @sobolevn @c-bata @dimaqq @ekohilas
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.