Skip to content

gh-158585: Fix refleak in _testcapi.bytes_resize() - #158806

Merged
vstinner merged 1 commit into
python:mainfrom
vstinner:fix_test_bytes_leak
Oct 4, 2026
Merged

vstinner merged 1 commit into
python:mainfrom
vstinner:fix_test_bytes_leak

Conversation

@vstinner

@vstinner vstinner commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

@vstinner
vstinner enabled auto-merge (squash) October 4, 2026 21:10
@vstinner
vstinner merged commit 587b7a5 into python:main Oct 4, 2026
96 of 98 checks passed
@vstinner
vstinner deleted the fix_test_bytes_leak branch October 4, 2026 22:07
vstinner added a commit that referenced this pull request Oct 16, 2026
…uted (#159555)

* gh-158585: Fix _PyBytes_Resize() if hash value is already computed (#158589)

_PyBytes_Resize() now creates a new bytes object if the hash value
was already computed.

bytes_resize_inplace() no longer sets the hash value to -1, since
this function must not be called if the hash value was already
computed.

Add tests on PyUnicode_Resize().

(cherry picked from commit 6e7738b)

* gh-158585: Fix refleak in _testcapi.bytes_resize() (#158806)

(cherry picked from commit 587b7a5)
vstinner added a commit that referenced this pull request Oct 16, 2026
…uted (#159585)

* [3.15] gh-158585: Fix _PyBytes_Resize() if hash value is already computed (#159555)

* gh-158585: Fix _PyBytes_Resize() if hash value is already computed (#158589)

_PyBytes_Resize() now creates a new bytes object if the hash value
was already computed.

bytes_resize_inplace() no longer sets the hash value to -1, since
this function must not be called if the hash value was already
computed.

Add tests on PyUnicode_Resize().

(cherry picked from commit 6e7738b)

* gh-158585: Fix refleak in _testcapi.bytes_resize() (#158806)

(cherry picked from commit 587b7a5)
(cherry picked from commit 251278d)

* Adjust code for 3.14
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