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

Python AST deprecations #195

Open
akaihola opened this issue Mar 17, 2024 · 1 comment
Open

Python AST deprecations #195

akaihola opened this issue Mar 17, 2024 · 1 comment

Comments

@akaihola
Copy link

In my CI build, I'm getting these deprecation warnings from Python 3.12:

  lib/python3.12/site-packages/astor/op_util.py:92: DeprecationWarning:
    ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
    precedence_data = dict((getattr(ast, x, None), z) for x, y, z in op_data)
  lib/python3.12/site-packages/flynt/utils/utils.py:74: DeprecationWarning:
    ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    ) -> Union[ast.FormattedValue, ast.Str]:
  lib/python3.12/site-packages/flynt/transform/format_call_transforms.py:22: DeprecationWarning:
    Attribute s is deprecated and will be removed in Python 3.14; use value instead
    string = fmt_call.func.value.s
  lib/python3.12/ast.py:407: DeprecationWarning:
    visit_Str is deprecated; add visit_Constant
    return visitor(node)
@ikamensh
Copy link
Owner

ikamensh commented Aug 21, 2024

Thanks for reporting!
hm, it seems ast.Str and ast.Num and perhaps other nodes will be all merged into ast.Constant. Naively replacing ast.Str with ast.Constant leads to errors in flynt.

Unfortunately I couldn't find a solution to suppress these warnings either, they are no issue for users until they start using python3.14, so if I could I'd just supress warnings until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants