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-132775: Add _PyCode_GetVarCounts() by ericsnowcurrently · Pull Request #133128 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Apr 29, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This helper is useful in a variety of ways, including in demonstrating how the different counts relate to one another.

It will be used in a later change to help identify if a function is "stateless", meaning it doesn't have any free vars or globals.

Note that a majority of this change is tests.

  • Issue: Improvements to test.support.interpreters.Interpreter #132775

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericsnowcurrently
Add _PyCode_GetVarCounts().
d95aef5
@ericsnowcurrently ericsnowcurrently added the skip news label Apr 29, 2025
@ericsnowcurrently
ericsnowcurrently requested a review from markshannon as a code owner April 29, 2025 03:21
@bedevere-app bedevere-app Bot added the awaiting core review label Apr 29, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Apr 29, 2025
Improvements to test.support.interpreters.Interpreter #132775
Closed
ericsnowcurrently added 4 commits April 28, 2025 21:33
@ericsnowcurrently
Fix the tests.
aaa98ac
@ericsnowcurrently
Add PyFunction_GET_BUILTINS().
c8181cc
@ericsnowcurrently
Optionally identify globals/builtins counts.
ddbe9bc
@ericsnowcurrently
Pass tstate to _PyCode_SetUnboundVarCounts().
195a1ec
iritkatriel
iritkatriel reviewed Apr 30, 2025
View reviewed changes
Comment thread Objects/codeobject.c Outdated

// Get the unbound counts.
struct co_unbound_counts unbound = {
.total = PyTuple_GET_SIZE(co->co_names),

@iritkatriel iritkatriel Apr 30, 2025

Copy link
Copy Markdown
Member

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.

compiler warning here

Sorry, something went wrong.

Uh oh!

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

All reactions
@iritkatriel

iritkatriel commented Apr 30, 2025

Copy link
Copy Markdown
Member

LGTM. But I'd run the refleaks buildbots before merging.

ericsnowcurrently reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

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

ericsnowcurrently added 2 commits April 30, 2025 11:42
@ericsnowcurrently
Add some comments.
998aeed
@ericsnowcurrently
Fix a compiler warning.
a727d7b
@ericsnowcurrently
ericsnowcurrently enabled auto-merge (squash) April 30, 2025 18:03
@ericsnowcurrently
ericsnowcurrently merged commit 94b4fcd into python:main Apr 30, 2025
@bedevere-app bedevere-app Bot removed the awaiting core review label Apr 30, 2025
@ericsnowcurrently
ericsnowcurrently deleted the add-pycode-get-var-counts branch April 30, 2025 18:22
@bedevere-bot

bedevere-bot commented Apr 30, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL8 LTO + PGO 3.x (tier-3) has failed when building commit 94b4fcd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/442/builds/9227) and take a look at the build logs.
  4. Check if the failure is related to this commit (94b4fcd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/442/builds/9227

Failed tests:

  • test_code

Summary of the results of the build (if available):

==

Click to see traceback logs
remote: Enumerating objects: 27, done.        
remote: Counting objects:   3% (1/27)        
remote: Counting objects:   7% (2/27)        
remote: Counting objects:  11% (3/27)        
remote: Counting objects:  14% (4/27)        
remote: Counting objects:  18% (5/27)        
remote: Counting objects:  22% (6/27)        
remote: Counting objects:  25% (7/27)        
remote: Counting objects:  29% (8/27)        
remote: Counting objects:  33% (9/27)        
remote: Counting objects:  37% (10/27)        
remote: Counting objects:  40% (11/27)        
remote: Counting objects:  44% (12/27)        
remote: Counting objects:  48% (13/27)        
remote: Counting objects:  51% (14/27)        
remote: Counting objects:  55% (15/27)        
remote: Counting objects:  59% (16/27)        
remote: Counting objects:  62% (17/27)        
remote: Counting objects:  66% (18/27)        
remote: Counting objects:  70% (19/27)        
remote: Counting objects:  74% (20/27)        
remote: Counting objects:  77% (21/27)        
remote: Counting objects:  81% (22/27)        
remote: Counting objects:  85% (23/27)        
remote: Counting objects:  88% (24/27)        
remote: Counting objects:  92% (25/27)        
remote: Counting objects:  96% (26/27)        
remote: Counting objects: 100% (27/27)        
remote: Counting objects: 100% (27/27), done.        
remote: Compressing objects:   7% (1/13)        
remote: Compressing objects:  15% (2/13)        
remote: Compressing objects:  23% (3/13)        
remote: Compressing objects:  30% (4/13)        
remote: Compressing objects:  38% (5/13)        
remote: Compressing objects:  46% (6/13)        
remote: Compressing objects:  53% (7/13)        
remote: Compressing objects:  61% (8/13)        
remote: Compressing objects:  69% (9/13)        
remote: Compressing objects:  76% (10/13)        
remote: Compressing objects:  84% (11/13)        
remote: Compressing objects:  92% (12/13)        
remote: Compressing objects: 100% (13/13)        
remote: Compressing objects: 100% (13/13), done.        
remote: Total 14 (delta 13), reused 2 (delta 1), pack-reused 0 (from 0)        
From https://github.com/python/cpython
 * branch                    main       -> FETCH_HEAD
Note: switching to '94b4fcd806e7b692955173d309ea3b70a193ad96'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 94b4fcd806e gh-132775: Add _PyCode_GetVarCounts() (gh-133128)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)

find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:3339: clean-retain-profile] Error 1 (ignored)

make: *** [Makefile:2453: buildbottest] Error 2
All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-bot

bedevere-bot commented Apr 30, 2025

Copy link
Copy Markdown

⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️

Hi! The buildbot s390x RHEL8 LTO 3.x (tier-3) has failed when building commit 94b4fcd.

What do you need to do:

  1. Don't panic.
  2. Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
  3. Go to the page of the buildbot that failed (https://buildbot.python.org/#/builders/567/builds/9141) and take a look at the build logs.
  4. Check if the failure is related to this commit (94b4fcd) or if it is a false positive.
  5. If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.

You can take a look at the buildbot page here:

https://buildbot.python.org/#/builders/567/builds/9141

Failed tests:

  • test_code

Summary of the results of the build (if available):

==

Click to see traceback logs
Note: switching to '94b4fcd806e7b692955173d309ea3b70a193ad96'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at 94b4fcd806e gh-132775: Add _PyCode_GetVarCounts() (gh-133128)
Switched to and reset branch 'main'

configure: WARNING: no system libmpdecimal found; falling back to bundled libmpdecimal (deprecated and scheduled for removal in Python 3.15)

make: *** [Makefile:2453: buildbottest] Error 2
All reactions

Sorry, something went wrong.

Uh oh!

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

@sobolevn sobolevn mentioned this pull request Apr 30, 2025
Commit with _PyCode_GetVarCounts() broke buildbots #133224
Closed
@ericsnowcurrently

ericsnowcurrently commented May 1, 2025

Copy link
Copy Markdown
Member Author

FYI, I'm looking into the failures.

All reactions

Sorry, something went wrong.

Uh oh!

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

ericsnowcurrently added a commit to ericsnowcurrently/cpython that referenced this pull request May 1, 2025
@ericsnowcurrently
Revert "pythongh-132775: Add _PyCode_GetVarCounts() (pythongh-133128)"
1740ecb
This reverts commit 94b4fcd.
ericsnowcurrently added a commit that referenced this pull request May 1, 2025
@ericsnowcurrently
Revert "gh-132775: Add _PyCode_GetVarCounts() (gh-133128)" (gh-133232)
811edcf
The change broke the s390 builds, so I'm reverting it while I investigate.

This reverts commit 94b4fcd.
ericsnowcurrently added a commit to ericsnowcurrently/cpython that referenced this pull request May 1, 2025
@ericsnowcurrently
pythongh-132775: Unrevert "Add _PyCode_GetVarCounts()"
d9c3672
This reverts commit 811edcf (pythongh-133128).
@ericsnowcurrently ericsnowcurrently mentioned this pull request May 1, 2025
gh-132775: Unrevert "Add _PyCode_GetVarCounts()" #133265
Merged
ericsnowcurrently added a commit that referenced this pull request May 5, 2025
@ericsnowcurrently
gh-132775: Unrevert "Add _PyCode_GetVarCounts()" (gh-133265)
24ebb9c
This reverts commit 811edcf (gh-133232), which itself reverted the original commit 811edcf (gh-133128).

We reverted the original change due to failing s390 builds (a big-endian architecture).
It ended up that I had not accommodated op caches.
This was referenced Jun 25, 2025
Undocumented 3.14 C API #135755
Closed
gh-135755: Document the new PyFunction_GET_BUILTINS macro #135934
Closed
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@ericsnowcurrently @Pranjal095
pythongh-132775: Unrevert "Add _PyCode_GetVarCounts()" (pythongh-133265)
02f2dcb
This reverts commit 811edcf (pythongh-133232), which itself reverted the original commit 811edcf (pythongh-133128).

We reverted the original change due to failing s390 builds (a big-endian architecture).
It ended up that I had not accommodated op caches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel left review comments
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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.

3 participants

@ericsnowcurrently @iritkatriel @bedevere-bot
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 01402520 — 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.