ast.Constant.n deprecated without warning #90953
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
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'
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']
The text was updated successfully, but these errors were encountered:
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:
>>> ast.Constant(value=42).n 42
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.
…Python 3.8 (#104199) `ast.Num`, `ast.Str`, `ast.Bytes`, `ast.Ellipsis` and `ast.NameConstant` now all emit deprecation warnings on import, access, instantation or `isinstance()` checks. Co-authored-by: Serhiy Storchaka <firstname.lastname@example.org>
…ed in Python 3.8 (python#104199) `ast.Num`, `ast.Str`, `ast.Bytes`, `ast.Ellipsis` and `ast.NameConstant` now all emit deprecation warnings on import, access, instantation or `isinstance()` checks. Co-authored-by: Serhiy Storchaka <email@example.com>
* main: pythonGH-102181: Improve specialization stats for SEND (pythonGH-102182) pythongh-103000: Optimise `dataclasses.asdict` for the common case (python#104364) pythongh-103538: Remove unused TK_AQUA code (pythonGH-103539) pythonGH-87695: Fix OSError from `pathlib.Path.glob()` (pythonGH-104292) pythongh-104263: Rely on Py_NAN and introduce Py_INFINITY (pythonGH-104202) pythongh-104010: Separate and improve docs for `typing.get_origin` and `typing.get_args` (python#104013) pythongh-101819: Adapt _io._BufferedIOBase_Type methods to Argument Clinic (python#104355) pythongh-103960: Dark mode: invert image brightness (python#103983) pythongh-104252: Immortalize Py_EMPTY_KEYS (pythongh-104253) pythongh-101819: Clean up _io windows console io after pythongh-104197 (python#104354) pythongh-101819: Harden _io init (python#104352) pythongh-103247: clear the module cache in a test in test_importlib/extensions/test_loader.py (pythonGH-104226) pythongh-103848: Adds checks to ensure that bracketed hosts found by urlsplit are of IPv6 or IPvFuture format (python#103849) pythongh-74895: adjust tests to work on Solaris (python#104326) pythongh-101819: Refactor _io in preparation for module isolation (python#104334) pythongh-90953: Don't use deprecated AST nodes in clinic.py (python#104322) pythongh-102327: Extend docs for "url" and "headers" parameters to HTTPConnection.request() pythongh-104328: Fix typo in ``typing.Generic`` multiple inheritance error message (python#104335)