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

gh-97922: Run the GC only on eval breaker #97920

Merged
merged 7 commits into from
Oct 8, 2022

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented Oct 5, 2022

@pablogsal pablogsal changed the title Run the GC only on eval breaker bpo-97922: Run the GC only on eval breaker Oct 5, 2022
@pablogsal pablogsal changed the title bpo-97922: Run the GC only on eval breaker gh-97922: Run the GC only on eval breaker Oct 5, 2022
Copy link
Member

@arhadthedev arhadthedev left a comment

Choose a reason for hiding this comment

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

A minor typo.

Doc/whatsnew/3.12.rst Outdated Show resolved Hide resolved
@pablogsal pablogsal force-pushed the gc_scheduled branch 3 times, most recently from 5951465 to 1634d14 Compare October 5, 2022 22:37
@markshannon markshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 5, 2022
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 1634d14 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Oct 5, 2022
@markshannon
Copy link
Member

Looks good, but let's run the buildbots before merging.

@brandtbucher
Copy link
Member

This fixes the new test:

diff --git a/Lib/test/test_frame.py b/Lib/test/test_frame.py
index 4b86a60d2f..4b5bb7f94a 100644
--- a/Lib/test/test_frame.py
+++ b/Lib/test/test_frame.py
@@ -277,7 +277,7 @@ def callback(phase, info):
             frame!
             """
             nonlocal sneaky_frame_object
-            sneaky_frame_object = sys._getframe().f_back
+            sneaky_frame_object = sys._getframe().f_back.f_back
             # We're done here:
             gc.callbacks.remove(callback)

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Looks mostly good! Just a couple of questions regarding eval breaker recomputation.

Also, would it be better to run the GC after signals, etc.? I would guess that prompt signal handling, etc. would be more important than prompt GC. I have a slight preference towards preserving the current behavior for when signals, etc. are handled and just moving the GC around, rather than potentially changing when everything else is handled too.

Modules/signalmodule.c Show resolved Hide resolved
Python/ceval_gil.c Outdated Show resolved Hide resolved
@pablogsal
Copy link
Member Author

Also, would it be better to run the GC after signals, etc.?

Indeed, it makes sense. I moved it after signals and pending calls but before gil switching

Copy link
Member

@brandtbucher brandtbucher left a comment

Choose a reason for hiding this comment

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

Cool, one more fixup:

Python/ceval_gil.c Outdated Show resolved Hide resolved
Co-authored-by: Brandt Bucher <[email protected]>
@pablogsal pablogsal merged commit 83eb827 into python:main Oct 8, 2022
@pablogsal pablogsal deleted the gc_scheduled branch October 8, 2022 14:57
carljm added a commit to carljm/cpython that referenced this pull request Oct 8, 2022
* main:
  pythongh-68686: Retire eptag ptag scripts (python#98064)
  pythongh-97922: Run the GC only on eval breaker (python#97920)
  GitHub Workflows security hardening (python#96492)
  Add `@ezio-melotti` as codeowner for `.github/`. (python#98079)
  pythongh-97913 Docs: Add walrus operator to the index (python#97921)
  [doc] Fix broken links to C extensions accelerating stdlib modules (python#96914)
  pythongh-97822: Fix http.server documentation reference to test() function (python#98027)
  pythongh-91052: Add PyDict_Unwatch for unwatching a dictionary (python#98055)
  pythonGH-98023: Change default child watcher to PidfdChildWatcher on supported systems (python#98024)
  pythonGH-94182: Run the PidfdChildWatcher on the running loop (python#94184)
carljm added a commit to carljm/cpython that referenced this pull request Oct 9, 2022
* main: (5519 commits)
  Minor edits to the Descriptor HowTo Guide (pythonGH-24901)
  Fix link to Lifecycle of a Pull Request in CONTRIBUTING (python#98102)
  pythonGH-94597: deprecate `SafeChildWatcher`, `FastChildWatcher` and `MultiLoopChildWatcher` child watchers  (python#98089)
  Auto-cancel old builds when new commit pushed to branch (python#98009)
  pythongh-95011: Migrate syslog module to Argument Clinic (pythonGH-95012)
  pythongh-68686: Retire eptag ptag scripts (python#98064)
  pythongh-97922: Run the GC only on eval breaker (python#97920)
  GitHub Workflows security hardening (python#96492)
  Add `@ezio-melotti` as codeowner for `.github/`. (python#98079)
  pythongh-97913 Docs: Add walrus operator to the index (python#97921)
  [doc] Fix broken links to C extensions accelerating stdlib modules (python#96914)
  pythongh-97822: Fix http.server documentation reference to test() function (python#98027)
  pythongh-91052: Add PyDict_Unwatch for unwatching a dictionary (python#98055)
  pythonGH-98023: Change default child watcher to PidfdChildWatcher on supported systems (python#98024)
  pythonGH-94182: Run the PidfdChildWatcher on the running loop (python#94184)
  pythongh-92886: make test_ast pass with -O (assertions off) (pythonGH-98058)
  pythongh-92886: make test_coroutines pass with -O (assertions off) (pythonGH-98060)
  pythongh-57179: Add note on symlinks for os.walk (python#94799)
  pythongh-94808: Fix regex on exotic platforms (python#98036)
  pythongh-90085: Remove vestigial -t and -c timeit options (python#94941)
  ...
mpage pushed a commit to mpage/cpython that referenced this pull request Oct 11, 2022
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.

5 participants