GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ast.Constant.n deprecated without warning · Issue #90953 · python/cpython

ast.Constant.n deprecated without warning #90953

New issue
Copy link
New issue
Copy link
Closed
Closed
ast.Constant.n deprecated without warning#90953
Copy link
Labels
3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

Description

jwilk
mannequin
opened on Feb 19, 2022
Issue body actions
BPO 46797
Nosy @jwilk, @serhiy-storchaka
PRs
  • gh-90953: Emit deprecation warnings for deprecated ast features #31432
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2022-02-19.08:29:16.968>
    labels = ['library', '3.11']
    title = 'ast.Constant.n deprecated without warning'
    updated_at = <Date 2022-02-19.12:24:07.912>
    user = 'https://github.com/jwilk'

    bugs.python.org fields:

    activity = <Date 2022-02-19.12:24:07.912>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2022-02-19.08:29:16.968>
    creator = 'jwilk'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 46797
    keywords = ['patch']
    message_count = 2.0
    messages = ['413541', '413546']
    nosy_count = 2.0
    nosy_names = ['jwilk', 'serhiy.storchaka']
    pr_nums = ['31432']
    priority = 'low'
    resolution = 'postponed'
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue46797'
    versions = ['Python 3.11']

    Linked PRs

    • gh-90953: Emit deprecation warnings for ast features deprecated in Python 3.8 #104199
    • gh-90953: Don't use deprecated AST nodes in clinic.py #104322
    • [3.9] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322) #140854
    • [3.10] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322) #140855
    • [3.11] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322) #140856

    Activity

    1. jwilk commented on Feb 19, 2022

      @jwilk
      jwilkmannequin
      on Feb 19, 2022
      MannequinAuthor
      More actions

      ast.Constant.n is documented to be deprecated, but you don't get any warning when you use it:

      $ python3.11 -Wd
      Python 3.11.0a5 (main, Feb 12 2022, 17:11:59) [GCC 9.3.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import ast
      >>> help(ast.Constant.n)
      Help on property:
      Deprecated. Use value instead.
      
      >>> ast.Constant(value=42).n
      42
    2. jwilk
      added
      3.11only security fixesonly security fixes
      stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory
      on Feb 19, 2022
    3. serhiy-storchaka commented on Feb 19, 2022

      @serhiy-storchaka
      serhiy-storchaka
      on Feb 19, 2022
      Member
      More actions

      It is because we did not have a plan for removing deprecates features. Deprecation in documentation only helps third-party code. Instead of adding a complex code which switches between using old and new names depending on Python version, the third-party code can continue to use old names without worring about deprecation warnings, and switch completely to using new features only when support of old Python versions be dropped. 3.7 and 3.8 are not so old and may be still supported in third-party code.

      I have created a PR which adds deprecation warnings, but I am not sure that it is worth to include it in 3.11.

    4. ezio-melotti
      transferred this issue fromon Apr 10, 2022
    5. AlexWaygood
      added a commit that references this issue on May 6, 2023

      gh-90953: Emit deprecation warnings for `ast` features deprecated in …

      376137f
    6. jbower-fb
      added a commit that references this issue on May 8, 2023

      pythongh-90953: Emit deprecation warnings for `ast` features deprecat…

      1173ce2
    7. AlexWaygood
      added 2 commits that reference this issue on May 9, 2023

      pythongh-90953: Don't use deprecated AST nodes in clinic.py

      d8d0ae6

      gh-90953: Don't use deprecated AST nodes in clinic.py (#104322)

      fe694a6
    8. carljm
      added a commit that references this issue on May 10, 2023

      Merge branch 'main' into fixloadsuperspec

      5976df9
    9. hugovk commented on Jan 11, 2024

      @hugovk
      hugovk
      on Jan 11, 2024
      Member
      More actions

      A deprecation warning is now raised:

      Python 3.12.1 (v3.12.1:2305ca5144, Dec  7 2023, 17:23:38) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> import ast
      >>> help(ast.Constant.n)
      Help on property:
      
          Deprecated. Use value instead.
      
      >>> ast.Constant(value=42).n
      <stdin>:1: DeprecationWarning: Attribute n is deprecated and will be removed in Python 3.14; use value instead
      42
    10. hugovk
      closed this as completedon Jan 11, 2024
    11. bnebgen-LANL
      added a commit that references this issue on May 30, 2024

      Replace `ast.Num` with `ast.Constant`

      28b0ade
    12. miss-islington
      added 3 commits that reference this issue on Oct 31, 2025

      pythongh-90953: Don't use deprecated AST nodes in clinic.py (pythonGH…

      eaf62ab

      pythongh-90953: Don't use deprecated AST nodes in clinic.py (pythonGH…

      e8cd18d

      pythongh-90953: Don't use deprecated AST nodes in clinic.py (pythonGH…

      1e8f2e7
    13. ambv
      added 3 commits that reference this issue on Oct 31, 2025

      [3.10] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322…

      9524203

      [3.9] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322)…

      fde6ac1

      [3.11] gh-90953: Don't use deprecated AST nodes in clinic.py (GH-104322…

      20fe182
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions

        You are visitor 01402503 — GeezerVison does not store the pages you look up.
        Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.