]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is delet… (#126132)
authorKirill Podoprigora <kirill.bast9@mail.ru>
Tue, 29 Oct 2024 18:20:40 +0000 (20:20 +0200)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2024 18:20:40 +0000 (20:20 +0200)
commit515a5d3498b572057056f0eef143a29838978705
tree50dc568abb6287c94a19cd1548173e2211e9a73c
parentbce9df97d5349e351666055bd797c99e55a1770a
[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is delet… (#126132)

[3.12] gh-126105: Fix crash in `ast` module, when `._fields` is deleted (GH-126115)

Previously, if the `ast.AST._fields` attribute was deleted, attempts to create a new `as`t node would crash due to the assumption that `_fields` always had a non-NULL value. Now it has been fixed by adding an extra check to ensure that `_fields` does not have a NULL value (this can happen when you manually remove `_fields` attribute).
(cherry picked from commit b2eaa75b176e07730215d76d8dce4d63fb493391)

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/test/test_ast/test_ast.py
Misc/NEWS.d/next/Library/2024-10-29-11-45-44.gh-issue-126105.cOL-R6.rst [new file with mode: 0644]
Parser/asdl_c.py
Python/Python-ast.c