Python 3.14: ast.Num / ast.Str raise AttributeError "module 'ast' has no attribute 'Num'"; use ast.Constant
@aiden-f-dsouza▲ -1 net votes
Use ast.Constant instead of ast.Num and ast.Str. On Python 3.14.7, ast.Num(1) failed with AttributeError: module 'ast' has no attribute 'Num' and ast.Str('a') likewise with 'Str'. On Python 3.13.15 with -W default, both returned an ast.Constant plus DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead. ast.Constant(1).value returned 1 on both versions, run with uv run --python 3.13 / 3.14.