Skip to content

Commit 3f327a5

Browse files
authored
Merge branch 'main' into gh-139269
2 parents 1e35b61 + 1b8dcda commit 3f327a5

39 files changed

+408
-48
lines changed

Doc/deprecations/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ Deprecations
99

1010
.. include:: pending-removal-in-3.19.rst
1111

12+
.. include:: pending-removal-in-3.20.rst
13+
1214
.. include:: pending-removal-in-future.rst
1315

1416
C API deprecations
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Pending removal in Python 3.20
2+
------------------------------
3+
4+
* The ``__version__`` attribute has been deprecated in these standard library
5+
modules and will be removed in Python 3.20.
6+
Use :py:data:`sys.version_info` instead.
7+
8+
- :mod:`argparse`
9+
- :mod:`csv`
10+
- :mod:`!ctypes.macholib`
11+
- :mod:`ipaddress`
12+
- :mod:`json`
13+
- :mod:`logging` (``__date__`` also deprecated)
14+
- :mod:`optparse`
15+
- :mod:`pickle`
16+
- :mod:`platform`
17+
- :mod:`re`
18+
- :mod:`socketserver`
19+
- :mod:`tabnanny`
20+
- :mod:`tkinter.font`
21+
- :mod:`tkinter.ttk`
22+
23+
(Contributed by Hugo van Kemenade in :gh:`76007`.)

Doc/library/dis.rst

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,11 +1102,6 @@ iterations of the loop.
11021102
Pushes ``co_consts[consti]`` onto the stack.
11031103

11041104

1105-
.. opcode:: LOAD_CONST_IMMORTAL (consti)
1106-
1107-
Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects.
1108-
1109-
11101105
.. opcode:: LOAD_SMALL_INT (i)
11111106

11121107
Pushes the integer ``i`` onto the stack.
@@ -1647,7 +1642,7 @@ iterations of the loop.
16471642

16481643
Pushes a ``NULL`` to the stack.
16491644
Used in the call sequence to match the ``NULL`` pushed by
1650-
:opcode:`LOAD_METHOD` for non-method calls.
1645+
:opcode:`!LOAD_METHOD` for non-method calls.
16511646

16521647
.. versionadded:: 3.11
16531648

@@ -1968,14 +1963,15 @@ but are replaced by real opcodes or removed before bytecode is generated.
19681963
Marks the end of the code block associated with the last ``SETUP_FINALLY``,
19691964
``SETUP_CLEANUP`` or ``SETUP_WITH``.
19701965

1966+
19711967
.. opcode:: JUMP
1972-
.. opcode:: JUMP_NO_INTERRUPT
1968+
JUMP_NO_INTERRUPT
19731969

19741970
Undirected relative jump instructions which are replaced by their
19751971
directed (forward/backward) counterparts by the assembler.
19761972

19771973
.. opcode:: JUMP_IF_TRUE
1978-
.. opcode:: JUMP_IF_FALSE
1974+
JUMP_IF_FALSE
19791975

19801976
Conditional jumps which do not impact the stack. Replaced by the sequence
19811977
``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
@@ -1991,12 +1987,6 @@ but are replaced by real opcodes or removed before bytecode is generated.
19911987
This opcode is now a pseudo-instruction.
19921988

19931989

1994-
.. opcode:: LOAD_METHOD
1995-
1996-
Optimized unbound method lookup. Emitted as a ``LOAD_ATTR`` opcode
1997-
with a flag set in the arg.
1998-
1999-
20001990
.. _opcode_collections:
20011991

20021992
Opcode collections

Doc/whatsnew/3.12.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1363,6 +1363,10 @@ Deprecated
13631363

13641364
.. include:: ../deprecations/pending-removal-in-3.17.rst
13651365

1366+
.. include:: ../deprecations/pending-removal-in-3.19.rst
1367+
1368+
.. include:: ../deprecations/pending-removal-in-3.20.rst
1369+
13661370
.. include:: ../deprecations/pending-removal-in-future.rst
13671371

13681372
.. _whatsnew312-removed:

Doc/whatsnew/3.13.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,10 @@ New Deprecations
20262026

20272027
.. include:: ../deprecations/pending-removal-in-3.17.rst
20282028

2029+
.. include:: ../deprecations/pending-removal-in-3.19.rst
2030+
2031+
.. include:: ../deprecations/pending-removal-in-3.20.rst
2032+
20292033
.. include:: ../deprecations/pending-removal-in-future.rst
20302034

20312035
CPython Bytecode Changes

Doc/whatsnew/3.14.rst

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2794,15 +2794,87 @@ Deprecated
27942794

27952795
.. include:: ../deprecations/pending-removal-in-3.19.rst
27962796

2797+
.. include:: ../deprecations/pending-removal-in-3.20.rst
2798+
27972799
.. include:: ../deprecations/pending-removal-in-future.rst
27982800

27992801

28002802
CPython bytecode changes
28012803
========================
28022804

2803-
* Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg ``NB_SUBSCR``.
2805+
* Replaced the opcode :opcode:`!BINARY_SUBSCR` by the :opcode:`BINARY_OP`
2806+
opcode with the ``NB_SUBSCR`` oparg.
2807+
(Contributed by Irit Katriel in :gh:`100239`.)
2808+
2809+
* Add the :opcode:`BUILD_INTERPOLATION` and :opcode:`BUILD_TEMPLATE`
2810+
opcodes to construct new :class:`~string.templatelib.Interpolation`
2811+
and :class:`~string.templatelib.Template` instances, respectively.
2812+
(Contributed by Lysandros Nikolaou and others in :gh:`132661`;
2813+
see also :ref:`PEP 750: Template strings <whatsnew314-pep750>`).
2814+
2815+
* Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode.
2816+
Use :opcode:`BUILD_MAP` instead.
2817+
(Contributed by Mark Shannon in :gh:`122160`.)
2818+
2819+
* Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with
2820+
:opcode:`LOAD_COMMON_CONSTANT` and add support for loading
2821+
:exc:`NotImplementedError`.
2822+
2823+
* Add the :opcode:`LOAD_FAST_BORROW` and :opcode:`LOAD_FAST_BORROW_LOAD_FAST_BORROW`
2824+
opcodes to reduce reference counting overhead when the interpreter can prove
2825+
that the reference in the frame outlives the reference loaded onto the stack.
2826+
(Contributed by Matt Page in :gh:`130704`.)
2827+
2828+
* Add the :opcode:`LOAD_SMALL_INT` opcode, which pushes a small integer
2829+
equal to the ``oparg`` to the stack.
2830+
The :opcode:`!RETURN_CONST` opcode is removed as it is no longer used.
2831+
(Contributed by Mark Shannon in :gh:`125837`.)
2832+
2833+
* Add the new :opcode:`LOAD_SPECIAL` instruction.
2834+
Generate code for :keyword:`with` and :keyword:`async with` statements
2835+
using the new instruction.
2836+
Removed the :opcode:`!BEFORE_WITH` and :opcode:`!BEFORE_ASYNC_WITH` instructions.
2837+
(Contributed by Mark Shannon in :gh:`120507`.)
2838+
2839+
* Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators.
2840+
(Contributed by Mark Shannon in :gh:`132554`.)
2841+
2842+
Pseudo-instructions
2843+
-------------------
2844+
2845+
* Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction
2846+
to support partially executed module-level annotations with
2847+
:ref:`deferred evaluation of annotations <whatsnew314-pep649>`.
2848+
(Contributed by Jelle Zijlstra in :gh:`130907`.)
2849+
2850+
* Add the :opcode:`!BINARY_OP_EXTEND` pseudo instruction,
2851+
which executes a pair of functions (guard and specialization functions)
2852+
accessed from the inline cache.
28042853
(Contributed by Irit Katriel in :gh:`100239`.)
28052854

2855+
* Add three specializations for :opcode:`CALL_KW`;
2856+
:opcode:`!CALL_KW_PY` for calls to Python functions,
2857+
:opcode:`!CALL_KW_BOUND_METHOD` for calls to bound methods, and
2858+
:opcode:`!CALL_KW_NON_PY` for all other calls.
2859+
(Contributed by Mark Shannon in :gh:`118093`.)
2860+
2861+
* Add the :opcode:`JUMP_IF_TRUE` and :opcode:`JUMP_IF_FALSE` pseudo instructions,
2862+
conditional jumps which do not impact the stack.
2863+
Replaced by the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
2864+
(Contributed by Irit Katriel in :gh:`124285`.)
2865+
2866+
* Add the :opcode:`!LOAD_CONST_MORTAL` pseudo instruction.
2867+
(Contributed by Mark Shannon in :gh:`128685`.)
2868+
2869+
* Add the :opcode:`!LOAD_CONST_IMMORTAL` pseudo instruction,
2870+
which does the same as :opcode:`!LOAD_CONST`, but is more efficient
2871+
for immortal objects.
2872+
(Contributed by Mark Shannon in :gh:`125837`.)
2873+
2874+
* Add the :opcode:`NOT_TAKEN` pseudo instruction, used by :mod:`sys.monitoring`
2875+
to record branch events (such as :monitoring-event:`BRANCH_LEFT`).
2876+
(Contributed by Mark Shannon in :gh:`122548`.)
2877+
28062878

28072879
C API changes
28082880
=============

Doc/whatsnew/3.15.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,9 +631,42 @@ hashlib
631631

632632
(Contributed by Bénédikt Tran in :gh:`134978`.)
633633

634+
__version__
635+
-----------
636+
637+
* The ``__version__`` attribute has been deprecated in these standard library
638+
modules and will be removed in Python 3.20.
639+
Use :py:data:`sys.version_info` instead.
640+
641+
- :mod:`argparse`
642+
- :mod:`csv`
643+
- :mod:`!ctypes.macholib`
644+
- :mod:`ipaddress`
645+
- :mod:`json`
646+
- :mod:`logging` (``__date__`` also deprecated)
647+
- :mod:`optparse`
648+
- :mod:`pickle`
649+
- :mod:`platform`
650+
- :mod:`re`
651+
- :mod:`socketserver`
652+
- :mod:`tabnanny`
653+
- :mod:`tkinter.font`
654+
- :mod:`tkinter.ttk`
655+
656+
(Contributed by Hugo van Kemenade in :gh:`76007`.)
634657

635658
.. Add deprecations above alphabetically, not here at the end.
636659
660+
.. include:: ../deprecations/pending-removal-in-3.16.rst
661+
662+
.. include:: ../deprecations/pending-removal-in-3.17.rst
663+
664+
.. include:: ../deprecations/pending-removal-in-3.19.rst
665+
666+
.. include:: ../deprecations/pending-removal-in-3.20.rst
667+
668+
.. include:: ../deprecations/pending-removal-in-future.rst
669+
637670
Removed
638671
=======
639672

Doc/whatsnew/3.7.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2483,7 +2483,7 @@ avoiding possible problems use new functions :c:func:`PySlice_Unpack` and
24832483
CPython bytecode changes
24842484
------------------------
24852485

2486-
There are two new opcodes: :opcode:`LOAD_METHOD` and :opcode:`!CALL_METHOD`.
2486+
There are two new opcodes: :opcode:`!LOAD_METHOD` and :opcode:`!CALL_METHOD`.
24872487
(Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)
24882488

24892489
The :opcode:`!STORE_ANNOTATION` opcode has been removed.

Lib/argparse.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
still considered an implementation detail.)
6565
"""
6666

67-
__version__ = '1.1'
6867
__all__ = [
6968
'ArgumentParser',
7069
'ArgumentError',
@@ -2773,3 +2772,12 @@ def error(self, message):
27732772
def _warning(self, message):
27742773
args = {'prog': self.prog, 'message': message}
27752774
self._print_message(_('%(prog)s: warning: %(message)s\n') % args, _sys.stderr)
2775+
2776+
2777+
def __getattr__(name):
2778+
if name == "__version__":
2779+
from warnings import _deprecated
2780+
2781+
_deprecated("__version__", remove=(3, 20))
2782+
return "1.1" # Do not change
2783+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Lib/csv.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@ class excel:
8181
"unregister_dialect", "DictReader", "DictWriter",
8282
"unix_dialect"]
8383

84-
__version__ = "1.0"
85-
8684

8785
class Dialect:
8886
"""Describe a CSV dialect.
@@ -511,3 +509,12 @@ def has_header(self, sample):
511509
hasHeader -= 1
512510

513511
return hasHeader > 0
512+
513+
514+
def __getattr__(name):
515+
if name == "__version__":
516+
from warnings import _deprecated
517+
518+
_deprecated("__version__", remove=(3, 20))
519+
return "1.0" # Do not change
520+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)