Skip to content

DeprecationWarning - python 3.14 #1035

Closed
Closed

Description

@MarcinWronecki

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)

Activity

  1. holymonson commented on Sep 17, 2025

    @holymonson
    2025-09-17T05:31:50.5143150Z     _string_type_nodes = (ast.Str, ast.Bytes)
    2025-09-17T05:31:50.5143337Z                           ^^^^^^^
    2025-09-17T05:31:50.5143517Z AttributeError: module 'ast' has no attribute 'Str'
    

    @sebastinas On python 3.14, it becomes a AttributeError rather than DeprecationWarning, may I ask if any plan on fixing it?

  2. viadezo1er commented on Sep 19, 2025

    @viadezo1er

    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.

  3. self-assigned this
    on Sep 20, 2025
  4. added theissue type on Sep 20, 2025
  5. added this to the release-0.26 milestone on Sep 20, 2025
  6. added a commit that references this issue on Sep 27, 2025
    064ae93
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions