Skip to content

mypy on python3.12 raises DeprecationWarning from ast #15330

Closed
@jakkdl

Description

@jakkdl

Bug Report

From https://docs.python.org/3.12/whatsnew/3.12.html

  • The following ast features have been deprecated in documentation since Python 3.8, now cause a DeprecationWarning to be emitted at runtime when they are accessed or used, and will be removed in Python 3.14:
    * ast.Num
    * ast.Str
    * ast.Bytes
    * ast.NameConstant
    * ast.Ellipsis

Use ast.Constant instead. (Contributed by Serhiy Storchaka in gh-90953.)

Raised in fastparse.py, but haven't checked if they're present elsewhere

mypy/mypy/fastparse.py

Lines 133 to 151 in 3d2f437

# TODO: Num, Str, Bytes, NameConstant, Ellipsis are deprecated in 3.8.
# TODO: Index, ExtSlice are deprecated in 3.9.
from ast import (
AST,
Attribute,
Bytes,
Call,
Ellipsis as ast3_Ellipsis,
Expression as ast3_Expression,
FunctionType,
Index,
Name,
NameConstant,
Num,
Starred,
Str,
UnaryOp,
USub,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions