Skip to content

gh-140009: Replace PyTuple_Pack with PyTuple_FromArray in _warnings#144760

Closed
andrewloux wants to merge 1 commit intopython:mainfrom
andrewloux:pytuple-fromarray-warnings
Closed

gh-140009: Replace PyTuple_Pack with PyTuple_FromArray in _warnings#144760
andrewloux wants to merge 1 commit intopython:mainfrom
andrewloux:pytuple-fromarray-warnings

Conversation

@andrewloux
Copy link

@andrewloux andrewloux commented Feb 12, 2026

Replaces PyTuple_Pack(N, ...) calls with PyTuple_FromArray() in Python/_warnings.c, avoiding variadic function call overhead.

Four call sites converted (2-element, 3-element, and 5-element tuples). PyTuple_Pack(1, ...) calls are not present in this file.

Part of #140009.

@python-cla-bot
Copy link

python-cla-bot bot commented Feb 12, 2026

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Feb 12, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@andrewloux andrewloux force-pushed the pytuple-fromarray-warnings branch from 57375b3 to cca09a7 Compare February 12, 2026 20:52
@bedevere-app
Copy link

bedevere-app bot commented Feb 12, 2026

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@andrewloux
Copy link
Author

Closing since the pyperf numbers I posted above don’t show a measurable improvement (benchmarks within noise / not significant). Happy to reopen / redo with a different benchmark methodology if maintainers think this is still worth taking for Python/_warnings.c.

@andrewloux andrewloux closed this Feb 12, 2026
@andrewloux andrewloux deleted the pytuple-fromarray-warnings branch February 13, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant