Skip to content

[3.14] gh-160179: Leave bytearray empty when __init__() fails midway (GH-160180) - #160204

Merged
gpshead merged 1 commit into
python:3.14from
gpshead:backport-5a63d35-3.14
Oct 22, 2026
Merged

gpshead merged 1 commit into
python:3.14from
gpshead:backport-5a63d35-3.14

Conversation

@gpshead

@gpshead gpshead commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

The list/tuple fast path and the buffer path resized the object before
filling it and did not undo the resize on error, leaving stale bytes.
(cherry picked from commit 5a63d35)

Manual backport notes (3.14): the Objects/bytearrayobject.c change applied
unchanged. Lib/test/test_bytes.py conflicted only on placement. On main the
new test follows the gh-153419 test_reinit_* tests, which 3.14 doesn't have,
so test_reinit_error goes at the end of ByteArrayTest instead. The test
itself is unchanged.

…idway (pythonGH-160180)

The list/tuple fast path and the buffer path resized the object before
filling it and did not undo the resize on error, leaving stale bytes.

(cherry picked from commit 5a63d35)
@bedevere-app bedevere-app Bot added the sprint label Oct 22, 2026
@github-project-automation github-project-automation Bot moved this to Todo in Sprint Oct 22, 2026
@gpshead
gpshead marked this pull request as ready for review October 22, 2026 05:27
@gpshead
gpshead enabled auto-merge (squash) October 22, 2026 05:27
@gpshead
gpshead merged commit 8cf3fec into python:3.14 Oct 22, 2026
53 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in Sprint Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant