Skip to content

[3.14] gh-158585: Fix _PyBytes_Resize() if hash value is already computed - #159585

Merged
vstinner merged 2 commits into
python:3.14from
vstinner:bytes_resize_14
Oct 16, 2026
Merged

vstinner merged 2 commits into
python:3.14from
vstinner:bytes_resize_14

Conversation

@vstinner

@vstinner vstinner commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

…y computed (python#159555)

* pythongh-158585: Fix _PyBytes_Resize() if hash value is already computed (python#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)

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

(cherry picked from commit 587b7a5)
(cherry picked from commit 251278d)
@vstinner
vstinner enabled auto-merge (squash) October 16, 2026 21:42
@vstinner
vstinner merged commit 8356e9c into python:3.14 Oct 16, 2026
51 checks passed
@vstinner
vstinner deleted the bytes_resize_14 branch October 16, 2026 22:09
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