Skip to content

gh-134584: Remove custom float decref ops - #142576

Merged
Fidget-Spinner merged 10 commits into
python:mainfrom
Fidget-Spinner:decref_float_refactor
Dec 15, 2025
Merged

Fidget-Spinner merged 10 commits into
python:mainfrom
Fidget-Spinner:decref_float_refactor

Conversation

@Fidget-Spinner

@Fidget-Spinner Fidget-Spinner commented Dec 11, 2025 •

Copy link
Copy Markdown
Member

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you leave the STACK_SIZE macro unchanged to avoid confusion and change https://github.com/python/cpython/pull/142576/files#diff-eac5ab7e741b8b825a24d31a5bf844e86086431fb698cfcabe1277b68c375ca2L199
instead.

Comment thread Python/optimizer_analysis.c Resolved
Comment thread Python/bytecodes.c Resolved

@markshannon markshannon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good now. Thanks.

@markshannon

Copy link
Copy Markdown
Member

One thing to note for the future: We are losing the ability to reuse one of the operands if its refcount was one. A possible future optimization is to not only track which references are deferred, but which are the only reference to the object. We can then avoid the allocation & deallocation that occurs in a + b + c

@Fidget-Spinner
Fidget-Spinner merged commit 0ac4e6c into python:main Dec 15, 2025
@Fidget-Spinner
Fidget-Spinner deleted the decref_float_refactor branch December 15, 2025 19:39
fatelei pushed a commit to fatelei/cpython that referenced this pull request Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants