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-148871: Add CONSTANT_EMPTY_TUPLE to LOAD_COMMON_CONSTANT by eendebakpt · Pull Request #149688 · python/cpython

Conversation

@eendebakpt

@eendebakpt eendebakpt commented May 11, 2026 •
edited by bedevere-app Bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Contributor

Add () as a new value for LOAD_COMMON_CONSTANT, following the existing pattern used for "" (CONSTANT_EMPTY_STR). The compiler now folds LOAD_CONST () into LOAD_COMMON_CONSTANT 12, dropping the entry from co_consts.

() is the most common constant left in co_consts after the existing LOAD_COMMON_CONSTANT rewrites. Frequencies in co_consts (top-level entries, recursing into nested code objects):

Constant stdlib (613,524 entries) pyperformance (9,550 entries) Immortal singleton?
() 14,270 (2.33%) 112 (1.17%) yes (Py_CONSTANT_EMPTY_TUPLE)
b"" 1,012 (0.16%) 4 (0.04%) yes (Py_CONSTANT_EMPTY_BYTES)
1.0 516 (0.08%) 14 (0.15%) no (would need new immortal float)
0.0 457 (0.07%) 13 (0.14%) no (would need new immortal float; care re: -0.0)
... 139 (0.02%) 1 (0.01%) yes (_Py_EllipsisObject)

Common sources of (): __slots__ = (), empty default-args tuples passed to MAKE_FUNCTION, __reduce__ returning (), etc.

b"" and ... are already immortal singletons, but less frequent. For reviewers: should we add these as well?

  • Issue: Extend and improve LOAD_COMMON_CONSTANT #148871

Sorry, something went wrong.

Uh oh!

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

All reactions
@eendebakpt
eendebakpt requested review from FFY00, ZeroIntensity, ericsnowcurrently, iritkatriel and markshannon as code owners May 11, 2026 15:24
@python-cla-bot

python-cla-bot Bot commented May 11, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

All reactions

Sorry, something went wrong.

Uh oh!

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

@bedevere-app bedevere-app Bot mentioned this pull request May 11, 2026
Extend and improve LOAD_COMMON_CONSTANT #148871
Open
@bedevere-app bedevere-app Bot added the awaiting review label May 11, 2026
@eendebakpt @claude
Add CONSTANT_EMPTY_TUPLE to LOAD_COMMON_CONSTANT
79cc39d
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@eendebakpt
eendebakpt force-pushed the load-common-const-empty-tuple branch from 84e6f85 to 79cc39d Compare May 11, 2026 15:28
@eendebakpt @claude
Add NEWS entry for pythongh-148871
56d633a
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@markshannon

markshannon commented May 19, 2026

Copy link
Copy Markdown
Member

There are, inevitably, merge conflicts.
Happy to merge when they're fixed

All reactions

Sorry, something went wrong.

Uh oh!

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

@eendebakpt
Merge remote-tracking branch 'origin/main' into load-common-const-emp…
369fe77
…ty-tuple

# Conflicts:
#	Include/internal/pycore_opcode_utils.h
#	Lib/opcode.py
#	Python/pylifecycle.c
markshannon
markshannon approved these changes May 21, 2026
View reviewed changes

@markshannon markshannon left a comment

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.

Looks good

Sorry, something went wrong.

Uh oh!

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

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 21, 2026
@markshannon
markshannon merged commit f2fa291 into python:main May 21, 2026
104 of 106 checks passed

Uh oh!

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

@bedevere-app bedevere-app Bot removed the awaiting merge label May 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@markshannon markshannon markshannon approved these changes
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@ZeroIntensity ZeroIntensity Awaiting requested review from ZeroIntensity ZeroIntensity is a code owner
@FFY00 FFY00 Awaiting requested review from FFY00 FFY00 is a code owner
@iritkatriel iritkatriel Awaiting requested review from iritkatriel iritkatriel is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

None yet

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.

2 participants

@eendebakpt @markshannon
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.