You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my case, it occurs when I use django shell_plus
/usr/src/venv/lib/python3.12/site-packages/bpython/simpleeval.py:36: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead _string_type_nodes = (ast.Str, ast.Bytes)
Debian 13.1
Kernel: Linux 6.12.43+deb13-amd64
Installed python3.14.0rc3 with pyenv:
pyenv install 3.14.0rc3
pyenv local 3.14.0rc3
pip install bython
bpython
The error message is (just changed the path to hide my home):
File "~/.pyenv/versions/3.14.0rc2/lib/python3.14/site-packages/bpython/simpleeval.py", line 36, in <module>
_string_type_nodes = (ast.Str, ast.Bytes)
AttributeError: module 'ast' has no attribute 'Str'
Changing ast.Str and ast.Bytes to ast.Constant solves the error, and enables me to use bpython as usual.
https://docs.python.org/3/library/ast.html for version 3.13.7: Deprecated since version 3.8: Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and ast.Ellipsis are still available, but they will be removed in future Python releases. In the meantime, instantiating them will return an instance of a different class.
Since "a different class" was already used, it probably retains the same behavior with no unseen change.
So the change needed to solve the issue seems minimal.
Activity
holymonson commentedon Sep 17, 2025
@sebastinas On python 3.14, it becomes a
AttributeErrorrather thanDeprecationWarning, may I ask if any plan on fixing it?viadezo1er commentedon Sep 19, 2025
Debian 13.1
Kernel: Linux 6.12.43+deb13-amd64
Installed python3.14.0rc3 with pyenv:
The error message is (just changed the path to hide my home):
Changing ast.Str and ast.Bytes to ast.Constant solves the error, and enables me to use bpython as usual.
https://docs.python.org/3/library/ast.html for version 3.13.7:
Deprecated since version 3.8: Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and ast.Ellipsis are still available, but they will be removed in future Python releases. In the meantime, instantiating them will return an instance of a different class.
Since "a different class" was already used, it probably retains the same behavior with no unseen change.
So the change needed to solve the issue seems minimal.
Align simple_eval with Python 3.10+ (fices #1035)
Align simple_eval with Python 3.10+ (fixes bpython#1035)