[3.15] gh-159739: Handle overlapping buffers in struct.pack_into (GH-159985) #160101

Merged
miss-islington opened 2:13pm on October 21, 2026 wanted to merge 1 commit into python/cpython 3.15 from
backport-31a7d99-3.15

Pull Request Overview

  • Opened on October 21, 2026
  • Status Merged
  • Commit count 1 with first commit October 21, 2026

Total Delta

0 Total Diff Delta

Open Days

Open 23 weekdays

Test Delta

0 Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Data pending calculation for pull request

Author avatar

[3.15] gh-159739: Handle overlapping buffers in struct.pack_into (GH-159985)

struct.pack_into() can use the same bytearray as both the destination and an s or p value. The copy then passes overlapping regions to memcpy, which is undefined in C and can produce platform-dependent results or a sanitizer abort. memmove makes the overlapping copy defined.
(cherry picked from commit 31a7d994a559a421814ca9e8edfcab21ae4a5b36)

Co-authored-by: Jelle Zijlstra [email protected]


  • Issue: gh-159739
    <!-- /gh-issue-number -->

PR was closed without comments.