]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-153844: Support AST input in symtable.symtable() (GH-153845)
authorSerhiy Storchaka <storchaka@gmail.com>
Fri, 17 Jul 2026 16:17:08 +0000 (19:17 +0300)
committerGitHub <noreply@github.com>
Fri, 17 Jul 2026 16:17:08 +0000 (19:17 +0300)
commit9d231cbc937f51c92f8d2883815aab64e52fe5e7
tree09a5e538bed968cd7c164b7e2df6867369761b17
parent8ca85b5bc5a888b8329915aff0ceb34de9373546
gh-153844: Support AST input in symtable.symtable() (GH-153845)

The builtin compile() accepts an AST object since Python 2.6, but
symtable.symtable() only accepted str and bytes, although the
implementation builds the symbol table from an AST anyway.  Accept an
AST object as well: convert it for the requested compile type, validate
it, honor future statements found in the tree, and build the symbol
table the same way the compiler does.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Doc/library/symtable.rst
Doc/whatsnew/3.16.rst
Lib/symtable.py
Lib/test/test_symtable.py
Misc/NEWS.d/next/Library/2026-07-17-14-30-00.gh-issue-153844.pYs7Kq.rst [new file with mode: 0644]
Modules/clinic/symtablemodule.c.h
Modules/symtablemodule.c