Skip to content

Commit 1ef6422

Browse files
generatedunixname1734921407115435facebook-github-bot
authored andcommitted
Import upstream CPython branch '3.14'
Summary: Imported Python `3.14.0rc3+` from upstream rev [`622f37f9dd0624b97e599ebb44bfa5cbdf86cfb6`](https://www.github.com/python/cpython/commit/622f37f9dd0624b97e599ebb44bfa5cbdf86cfb6) (committed 2025-09-29 21:12:28+00:00). # Commit Info Base: (`3.14.0rc3+`) - [`7a65a477951a541e29920832e4ab90e0b7783f21`](https://www.github.com/python/cpython/commit/7a65a477951a541e29920832e4ab90e0b7783f21) (commit date: 2025-09-29 08:16:25+00:00) Imported: (`3.14.0rc3+`) - [`622f37f9dd0624b97e599ebb44bfa5cbdf86cfb6`](https://www.github.com/python/cpython/commit/622f37f9dd0624b97e599ebb44bfa5cbdf86cfb6) (commit date: 2025-09-29 21:12:28+00:00) Reviewed By: itamaro Differential Revision: D83562571 fbshipit-source-id: 7771efabcf53fe5cef37e694154aea3a138e0cca
1 parent 50ccc8b commit 1ef6422

6 files changed

Lines changed: 103 additions & 25 deletions

File tree

Doc/library/dis.rst

Lines changed: 9 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,20 @@ 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+
1967+
.. opcode:: LOAD_CONST_IMMORTAL (consti)
1968+
1969+
Works as :opcode:`LOAD_CONST`, but is more efficient for immortal objects.
1970+
1971+
19711972
.. opcode:: JUMP
1972-
.. opcode:: JUMP_NO_INTERRUPT
1973+
JUMP_NO_INTERRUPT
19731974

19741975
Undirected relative jump instructions which are replaced by their
19751976
directed (forward/backward) counterparts by the assembler.
19761977

19771978
.. opcode:: JUMP_IF_TRUE
1978-
.. opcode:: JUMP_IF_FALSE
1979+
JUMP_IF_FALSE
19791980

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

19931994

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-
20001995
.. _opcode_collections:
20011996

20021997
Opcode collections

Doc/tools/templates/download.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ <h1>{% trans %}Download Python {{ dl_version }} documentation{% endtrans %}</h1>
4040
<th>{% trans %}Packed as .zip{% endtrans %}</th>
4141
<th>{% trans %}Packed as .tar.bz2{% endtrans %}</th>
4242
</tr>
43-
<tr>
44-
<td>{% trans %}PDF{% endtrans %}</td>
45-
<td>{% trans download_size="17" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-pdf-a4.zip">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
46-
<td>{% trans download_size="17" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-pdf-a4.tar.bz2">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
47-
</tr>
4843
<tr>
4944
<td>{% trans %}HTML{% endtrans %}</td>
5045
<td>{% trans download_size="13" %}<a href="{{ dl_base }}/python-{{ dl_version }}-docs-html.zip">Download</a> (ca. {{ download_size }} MiB){% endtrans %}</td>
@@ -69,6 +64,13 @@ <h1>{% trans %}Download Python {{ dl_version }} documentation{% endtrans %}</h1>
6964

7065
<p>{% trans %}These archives contain all the content in the documentation.{% endtrans %}</p>
7166

67+
<p>{% trans %}
68+
We no longer provide pre-built PDFs of the documentation.
69+
To build a PDF archive, follow the instructions in the
70+
<a href="https://devguide.python.org/documentation/start-documenting/#building-the-documentation">Developer's Guide</a>
71+
and run <code>make dist-pdf</code> in the <code>Doc/</code> directory of a copy of the CPython repository.
72+
{% endtrans %}</p>
73+
7274

7375
<h2>{% trans %}Unpacking{% endtrans %}</h2>
7476

Doc/whatsnew/3.14.rst

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2800,9 +2800,79 @@ Deprecated
28002800
CPython bytecode changes
28012801
========================
28022802

2803-
* Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg ``NB_SUBSCR``.
2803+
* Replaced the opcode :opcode:`!BINARY_SUBSCR` by the :opcode:`BINARY_OP`
2804+
opcode with the ``NB_SUBSCR`` oparg.
28042805
(Contributed by Irit Katriel in :gh:`100239`.)
28052806

2807+
* Add the :opcode:`BUILD_INTERPOLATION` and :opcode:`BUILD_TEMPLATE`
2808+
opcodes to construct new :class:`~string.templatelib.Interpolation`
2809+
and :class:`~string.templatelib.Template` instances, respectively.
2810+
(Contributed by Lysandros Nikolaou and others in :gh:`132661`;
2811+
see also :ref:`PEP 750: Template strings <whatsnew314-pep750>`).
2812+
2813+
* Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode.
2814+
Use :opcode:`BUILD_MAP` instead.
2815+
(Contributed by Mark Shannon in :gh:`122160`.)
2816+
2817+
* Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with
2818+
:opcode:`LOAD_COMMON_CONSTANT` and add support for loading
2819+
:exc:`NotImplementedError`.
2820+
2821+
* Add the :opcode:`LOAD_FAST_BORROW` and :opcode:`LOAD_FAST_BORROW_LOAD_FAST_BORROW`
2822+
opcodes to reduce reference counting overhead when the interpreter can prove
2823+
that the reference in the frame outlives the reference loaded onto the stack.
2824+
(Contributed by Matt Page in :gh:`130704`.)
2825+
2826+
* Add the :opcode:`LOAD_SMALL_INT` opcode, which pushes a small integer
2827+
equal to the ``oparg`` to the stack.
2828+
The :opcode:`!RETURN_CONST` opcode is removed as it is no longer used.
2829+
(Contributed by Mark Shannon in :gh:`125837`.)
2830+
2831+
* Add the new :opcode:`LOAD_SPECIAL` instruction.
2832+
Generate code for :keyword:`with` and :keyword:`async with` statements
2833+
using the new instruction.
2834+
Removed the :opcode:`!BEFORE_WITH` and :opcode:`!BEFORE_ASYNC_WITH` instructions.
2835+
(Contributed by Mark Shannon in :gh:`120507`.)
2836+
2837+
* Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators.
2838+
(Contributed by Mark Shannon in :gh:`132554`.)
2839+
2840+
Pseudo-instructions
2841+
-------------------
2842+
2843+
* Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction
2844+
to support partially executed module-level annotations with
2845+
:ref:`deferred evaluation of annotations <whatsnew314-pep649>`.
2846+
(Contributed by Jelle Zijlstra in :gh:`130907`.)
2847+
2848+
* Add the :opcode:`!BINARY_OP_EXTEND` pseudo instruction,
2849+
which executes a pair of functions (guard and specialization functions)
2850+
accessed from the inline cache.
2851+
(Contributed by Irit Katriel in :gh:`100239`.)
2852+
2853+
* Add three specializations for :opcode:`CALL_KW`;
2854+
:opcode:`!CALL_KW_PY` for calls to Python functions,
2855+
:opcode:`!CALL_KW_BOUND_METHOD` for calls to bound methods, and
2856+
:opcode:`!CALL_KW_NON_PY` for all other calls.
2857+
(Contributed by Mark Shannon in :gh:`118093`.)
2858+
2859+
* Add the :opcode:`JUMP_IF_TRUE` and :opcode:`JUMP_IF_FALSE` pseudo instructions,
2860+
conditional jumps which do not impact the stack.
2861+
Replaced by the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
2862+
(Contributed by Irit Katriel in :gh:`124285`.)
2863+
2864+
* Add the :opcode:`!LOAD_CONST_MORTAL` pseudo instruction.
2865+
(Contributed by Mark Shannon in :gh:`128685`.)
2866+
2867+
* Add the :opcode:`LOAD_CONST_IMMORTAL` pseudo instruction,
2868+
which does the same as :opcode:`!LOAD_CONST`, but is more efficient
2869+
for immortal objects.
2870+
(Contributed by Mark Shannon in :gh:`125837`.)
2871+
2872+
* Add the :opcode:`NOT_TAKEN` pseudo instruction, used by :mod:`sys.monitoring`
2873+
to record branch events (such as :monitoring-event:`BRANCH_LEFT`).
2874+
(Contributed by Mark Shannon in :gh:`122548`.)
2875+
28062876

28072877
C API changes
28082878
=============

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/_pyrepl/utils.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
ZERO_WIDTH_BRACKET = re.compile(r"\x01.*?\x02")
2121
ZERO_WIDTH_TRANS = str.maketrans({"\x01": "", "\x02": ""})
2222
IDENTIFIERS_AFTER = {"def", "class"}
23+
KEYWORD_CONSTANTS = {"True", "False", "None"}
2324
BUILTINS = {str(name) for name in dir(builtins) if not name.startswith('_')}
2425

2526

@@ -196,12 +197,12 @@ def gen_colors_from_token_stream(
196197
is_def_name = False
197198
span = Span.from_token(token, line_lengths)
198199
yield ColorSpan(span, "definition")
199-
elif token.string in ("True", "False", "None"):
200-
span = Span.from_token(token, line_lengths)
201-
yield ColorSpan(span, "keyword_constant")
202200
elif keyword.iskeyword(token.string):
201+
span_cls = "keyword"
202+
if token.string in KEYWORD_CONSTANTS:
203+
span_cls = "keyword_constant"
203204
span = Span.from_token(token, line_lengths)
204-
yield ColorSpan(span, "keyword")
205+
yield ColorSpan(span, span_cls)
205206
if token.string in IDENTIFIERS_AFTER:
206207
is_def_name = True
207208
elif (

Programs/_testembed.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,18 @@ static int test_pre_initialization_sys_options(void)
360360
size_t xoption_len = wcslen(static_xoption);
361361
wchar_t *dynamic_once_warnoption = \
362362
(wchar_t *) calloc(warnoption_len+1, sizeof(wchar_t));
363+
if (dynamic_once_warnoption == NULL) {
364+
error("out of memory allocating warnoption");
365+
return 1;
366+
}
363367
wchar_t *dynamic_xoption = \
364368
(wchar_t *) calloc(xoption_len+1, sizeof(wchar_t));
369+
if (dynamic_xoption == NULL) {
370+
free(dynamic_once_warnoption);
371+
error("out of memory allocating xoption");
372+
return 1;
373+
}
374+
365375
wcsncpy(dynamic_once_warnoption, static_warnoption, warnoption_len+1);
366376
wcsncpy(dynamic_xoption, static_xoption, xoption_len+1);
367377

0 commit comments

Comments
 (0)