]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#126115)
authorsobolevn <mail@sobolevn.me>
Tue, 29 Oct 2024 15:42:48 +0000 (18:42 +0300)
committerGitHub <noreply@github.com>
Tue, 29 Oct 2024 15:42:48 +0000 (17:42 +0200)
commitb2eaa75b176e07730215d76d8dce4d63fb493391
tree69f1cbd485328cf6753cd1b5c30fca5dd2b84bf4
parent0bbbe15f5688552236c48f2b6e320c5312720b8e
gh-126105: Fix crash in `ast` module, when `._fields` is deleted (#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).
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