Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mypy on python3.12 raises DeprecationWarning from ast #15330

Closed
jakkdl opened this issue May 31, 2023 · 1 comment
Closed

mypy on python3.12 raises DeprecationWarning from ast #15330

jakkdl opened this issue May 31, 2023 · 1 comment
Labels
bug mypy got something wrong

Comments

@jakkdl
Copy link

jakkdl commented May 31, 2023

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,
)

@sobolevn
Copy link
Member

List of actual warnings I get:

/Users/sobolev/Desktop/mypy/mypy/fastparse.py:135: DeprecationWarning: ast.Bytes is deprecated and will be removed in Python 3.14; use ast.Constant instead
  from ast import (
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:135: DeprecationWarning: ast.Ellipsis is deprecated and will be removed in Python 3.14; use ast.Constant instead
  from ast import (
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:135: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
  from ast import (
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:135: DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
  from ast import (
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:135: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
  from ast import (
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:2000: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1585: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = BytesExpr(bytes_to_human_readable_repr(n.s))
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:2000: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:2000: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:2000: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  return parse_type_string(n.s, "builtins.str", self.line, n.col_offset)
/Users/sobolev/Desktop/mypy/mypy/fastparse.py:1583: DeprecationWarning: Attribute s is deprecated and will be removed in Python 3.14; use value instead
  e = StrExpr(n.s)

sobolevn added a commit that referenced this issue Jul 3, 2023
Warnings before:
#15330 (comment)
Warnings after:

```
(.venv312) ~/Desktop/mypy  master ✗                                                       
» python -m mypy ex.py
Success: no issues found in 1 source file
```

Zero :)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@sobolevn sobolevn closed this as completed Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants