This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ast.Constant.n deprecated without warning
Type: Stage: patch review
Components: Library (Lib) Versions: Python 3.11
process
Status: open Resolution: postponed
Dependencies: Superseder:
Assigned To: Nosy List: jwilk, serhiy.storchaka
Priority: low Keywords: patch

Created on 2022-02-19 08:29 by jwilk, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 31432 open serhiy.storchaka, 2022-02-19 12:22
Messages (2)
msg413541 - (view) Author: Jakub Wilk (jwilk) Date: 2022-02-19 08:29
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
msg413546 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2022-02-19 12:24
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.
History
Date User Action Args
2022-04-11 14:59:56adminsetgithub: 90953
2022-02-19 12:24:07serhiy.storchakasetpriority: normal -> low
resolution: postponed
messages: + msg413546
2022-02-19 12:22:18serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request29567
2022-02-19 08:29:16jwilkcreate