Skip to content

ast.NameConstant, ast.Str,ast.Num is deprecated and will be removeed from Python 3.14 #419

@hroncok

Description

@hroncok

What happened? What is the problem?

pytest lets me know:

specfile/formatter.py:32: DeprecationWarning: ast.NameConstant is deprecated and will be removed in Python 3.14; use ast.Constant instead
    if isinstance(node, (ast.Constant, ast.NameConstant)):

specfile/formatter.py:34: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead
    elif isinstance(node, ast.Str):

specfile/formatter.py:36: DeprecationWarning: ast.Num is deprecated and will be removed in Python 3.14; use ast.Constant instead
    elif isinstance(node, ast.Num):

This has already been removed from Python 3.14.0a1.

If you still need to support Python 3.6 and 3.7 (out of life upstream), you might need to guard this by an if, like here: pypa/flit#684

What did you expect to happen?

No DeprecationWarnings

Example URL(s)

No response

Steps to reproduce

run code that uses specfile via pytest

Workaround

  • There is an existing workaround that can be used until this issue is fixed.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions