From 0e6551629177bb6bf6cb4c3beddf6d8d7335ae20 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 6 May 2022 10:19:14 +0300 Subject: [PATCH 1/2] Add a future pending removal --- Doc/whatsnew/3.11.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 7cddf6ba29cf53..5f4f09b6f9de36 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1227,6 +1227,24 @@ C API: * :c:type:`PyUnicodeObject` * :c:func:`PyUnicode_InternImmortal()` +Pending Removal in Future Versions +================================== + +The following APIs were deprecated in earlier Python versions and will be removed, +although there is currently no date scheduled for their removal. + +Python API: + +* Currently Python accepts numeric literals immediately followed by keywords, + for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing + and ambiguous expressions like ``[0x1for x in y]`` (which can be + interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in + this release, a deprecation warning is raised if the numeric literal is + immediately followed by one of keywords :keyword:`and`, :keyword:`else`, + :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. + In future releases it will be changed to syntax warning, and finally to + syntax error. + (Contributed by Serhiy Storchaka in :issue:`43833`). Removed ======= From bcf1609d2508d20736275b6e678d7db253f35523 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 6 May 2022 10:21:39 +0300 Subject: [PATCH 2/2] Edit future pending removal --- Doc/whatsnew/3.11.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 5f4f09b6f9de36..8b5629d952d297 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -1238,13 +1238,12 @@ Python API: * Currently Python accepts numeric literals immediately followed by keywords, for example ``0in x``, ``1or x``, ``0if 1else 2``. It allows confusing and ambiguous expressions like ``[0x1for x in y]`` (which can be - interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``). Starting in - this release, a deprecation warning is raised if the numeric literal is + interpreted as ``[0x1 for x in y]`` or ``[0x1f or x in y]``). + A deprecation warning is raised if the numeric literal is immediately followed by one of keywords :keyword:`and`, :keyword:`else`, :keyword:`for`, :keyword:`if`, :keyword:`in`, :keyword:`is` and :keyword:`or`. In future releases it will be changed to syntax warning, and finally to syntax error. - (Contributed by Serhiy Storchaka in :issue:`43833`). Removed =======