summaryrefslogtreecommitdiffstats
path: root/Python/executor_cases.c.h
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-09-02 10:47:18 (GMT)
committerGitHub <noreply@github.com>2024-09-02 10:47:18 (GMT)
commit57ba3b0c6e87264fc42ecf31780ec7c598380347 (patch)
treef22eeb0c8c8244254705ef7b17b6d5639f174a80 /Python/executor_cases.c.h
parent3455d8560ae7be1f314593b16d20562294f9e50b (diff)
downloadcpython-57ba3b0c6e87264fc42ecf31780ec7c598380347.zip
cpython-57ba3b0c6e87264fc42ecf31780ec7c598380347.tar.gz
cpython-57ba3b0c6e87264fc42ecf31780ec7c598380347.tar.bz2
[3.13] gh-122527: Fix a crash on deallocation of `PyStructSequence` (GH-122577) (#122625)
gh-122527: Fix a crash on deallocation of `PyStructSequence` (GH-122577) The `PyStructSequence` destructor would crash if it was deallocated after its type's dictionary was cleared by the GC, because it couldn't compute the "real size" of the instance. This could occur with relatively straightforward code in the free-threaded build or with a reference cycle involving the type in the default build, due to differing orders in which `tp_clear()` was called. Account for the non-sequence fields in `tp_basicsize` and use that, along with `Py_SIZE()`, to compute the "real" size of a `PyStructSequence` in the dealloc function. This avoids the accesses to the type's dictionary during dealloc, which were unsafe. (cherry picked from commit 4b63cd170e5dd840bffc80922f09f2d69932ff5c) Co-authored-by: Sam Gross <colesbury@gmail.com>
Diffstat (limited to 'Python/executor_cases.c.h')
0 files changed, 0 insertions, 0 deletions