Skip to content

Commit 4f09573

Browse files
authored
Merge branch 'main' into fix-issue-88336
2 parents 8b7ea78 + 61bef62 commit 4f09573

File tree

187 files changed

+5630
-2246
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+5630
-2246
lines changed

Doc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ dist:
217217
# as otherwise the full latexmk process is run twice.
218218
# ($$ is needed to escape the $; https://www.gnu.org/software/make/manual/make.html#Basics-of-Variable-References)
219219
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
220-
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
220+
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
221221
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-a4.zip
222222
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-a4.tar.bz2
223223
@echo "Build finished and archived!"
@@ -227,7 +227,7 @@ dist:
227227
rm -rf build/latex
228228
$(MAKE) latex PAPER=letter
229229
-sed -i 's/: all-$$(FMT)/:/' build/latex/Makefile
230-
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
230+
(cd build/latex; $(MAKE) clean && $(MAKE) --jobs=$$((`nproc`+1)) --output-sync LATEXMKOPTS='-quiet' all-pdf && $(MAKE) FMT=pdf zip bz2)
231231
cp build/latex/docs-pdf.zip dist/python-$(DISTVERSION)-docs-pdf-letter.zip
232232
cp build/latex/docs-pdf.tar.bz2 dist/python-$(DISTVERSION)-docs-pdf-letter.tar.bz2
233233
@echo "Build finished and archived!"

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Initializing and finalizing the interpreter
426426
loaded extension modules loaded by Python are not unloaded. Small amounts of
427427
memory allocated by the Python interpreter may not be freed (if you find a leak,
428428
please report it). Memory tied up in circular references between objects is not
429-
freed. Interned strings will all be deallocated regarldess of their reference count.
429+
freed. Interned strings will all be deallocated regardless of their reference count.
430430
Some memory allocated by extension modules may not be freed. Some extensions may not
431431
work properly if their initialization routine is called more than once; this can
432432
happen if an application calls :c:func:`Py_Initialize` and :c:func:`Py_FinalizeEx`

Doc/c-api/long.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,32 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
6969
on failure.
7070
7171
72+
.. c:function:: PyObject* PyLong_FromInt32(int32_t value)
73+
PyObject* PyLong_FromInt64(int64_t value)
74+
75+
Return a new :c:type:`PyLongObject` object from a signed C
76+
:c:expr:`int32_t` or :c:expr:`int64_t`, or ``NULL``
77+
with an exception set on failure.
78+
79+
.. versionadded:: 3.14
80+
81+
7282
.. c:function:: PyObject* PyLong_FromUnsignedLongLong(unsigned long long v)
7383
7484
Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long long`,
7585
or ``NULL`` on failure.
7686
7787
88+
.. c:function:: PyObject* PyLong_FromUInt32(uint32_t value)
89+
PyObject* PyLong_FromUInt64(uint64_t value)
90+
91+
Return a new :c:type:`PyLongObject` object from an unsigned C
92+
:c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL``
93+
with an exception set on failure.
94+
95+
.. versionadded:: 3.14
96+
97+
7898
.. c:function:: PyObject* PyLong_FromDouble(double v)
7999
80100
Return a new :c:type:`PyLongObject` object from the integer part of *v*, or
@@ -337,6 +357,43 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
337357
This function will no longer use :meth:`~object.__int__`.
338358
339359
360+
.. c:function:: int PyLong_AsInt32(PyObject *obj, int32_t *value)
361+
int PyLong_AsInt64(PyObject *obj, int64_t *value)
362+
363+
Set *\*value* to a signed C :c:expr:`int32_t` or :c:expr:`int64_t`
364+
representation of *obj*.
365+
366+
If the *obj* value is out of range, raise an :exc:`OverflowError`.
367+
368+
Set *\*value* and return ``0`` on success.
369+
Set an exception and return ``-1`` on error.
370+
371+
*value* must not be ``NULL``.
372+
373+
.. versionadded:: 3.14
374+
375+
376+
.. c:function:: int PyLong_AsUInt32(PyObject *obj, uint32_t *value)
377+
int PyLong_AsUInt64(PyObject *obj, uint64_t *value)
378+
379+
Set *\*value* to an unsigned C :c:expr:`uint32_t` or :c:expr:`uint64_t`
380+
representation of *obj*.
381+
382+
If *obj* is not an instance of :c:type:`PyLongObject`, first call its
383+
:meth:`~object.__index__` method (if present) to convert it to a
384+
:c:type:`PyLongObject`.
385+
386+
* If *obj* is negative, raise a :exc:`ValueError`.
387+
* If the *obj* value is out of range, raise an :exc:`OverflowError`.
388+
389+
Set *\*value* and return ``0`` on success.
390+
Set an exception and return ``-1`` on error.
391+
392+
*value* must not be ``NULL``.
393+
394+
.. versionadded:: 3.14
395+
396+
340397
.. c:function:: double PyLong_AsDouble(PyObject *pylong)
341398
342399
Return a C :c:expr:`double` representation of *pylong*. *pylong* must be

Doc/c-api/tuple.rst

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,27 @@ Tuple Objects
3333
3434
.. c:function:: PyObject* PyTuple_New(Py_ssize_t len)
3535
36-
Return a new tuple object of size *len*, or ``NULL`` on failure.
36+
Return a new tuple object of size *len*,
37+
or ``NULL`` with an exception set on failure.
3738
3839
3940
.. c:function:: PyObject* PyTuple_Pack(Py_ssize_t n, ...)
4041
41-
Return a new tuple object of size *n*, or ``NULL`` on failure. The tuple values
42+
Return a new tuple object of size *n*,
43+
or ``NULL`` with an exception set on failure. The tuple values
4244
are initialized to the subsequent *n* C arguments pointing to Python objects.
4345
``PyTuple_Pack(2, a, b)`` is equivalent to ``Py_BuildValue("(OO)", a, b)``.
4446
4547
4648
.. c:function:: Py_ssize_t PyTuple_Size(PyObject *p)
4749
4850
Take a pointer to a tuple object, and return the size of that tuple.
51+
On error, return ``-1`` and with an exception set.
4952
5053
5154
.. c:function:: Py_ssize_t PyTuple_GET_SIZE(PyObject *p)
5255
53-
Return the size of the tuple *p*, which must be non-``NULL`` and point to a tuple;
54-
no error checking is performed.
56+
Like :c:func:`PyTuple_Size`, but without error checking.
5557
5658
5759
.. c:function:: PyObject* PyTuple_GetItem(PyObject *p, Py_ssize_t pos)
@@ -74,8 +76,10 @@ Tuple Objects
7476
.. c:function:: PyObject* PyTuple_GetSlice(PyObject *p, Py_ssize_t low, Py_ssize_t high)
7577
7678
Return the slice of the tuple pointed to by *p* between *low* and *high*,
77-
or ``NULL`` on failure. This is the equivalent of the Python expression
78-
``p[low:high]``. Indexing from the end of the tuple is not supported.
79+
or ``NULL`` with an exception set on failure.
80+
81+
This is the equivalent of the Python expression ``p[low:high]``.
82+
Indexing from the end of the tuple is not supported.
7983
8084
8185
.. c:function:: int PyTuple_SetItem(PyObject *p, Py_ssize_t pos, PyObject *o)
@@ -141,6 +145,8 @@ type.
141145
Create a new struct sequence type from the data in *desc*, described below. Instances
142146
of the resulting type can be created with :c:func:`PyStructSequence_New`.
143147
148+
Return ``NULL`` with an exception set on failure.
149+
144150
145151
.. c:function:: void PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc)
146152
@@ -149,8 +155,8 @@ type.
149155
150156
.. c:function:: int PyStructSequence_InitType2(PyTypeObject *type, PyStructSequence_Desc *desc)
151157
152-
The same as ``PyStructSequence_InitType``, but returns ``0`` on success and ``-1`` on
153-
failure.
158+
Like :c:func:`PyStructSequence_InitType`, but returns ``0`` on success
159+
and ``-1`` with an exception set on failure.
154160
155161
.. versionadded:: 3.4
156162
@@ -207,6 +213,8 @@ type.
207213
Creates an instance of *type*, which must have been created with
208214
:c:func:`PyStructSequence_NewType`.
209215
216+
Return ``NULL`` with an exception set on failure.
217+
210218
211219
.. c:function:: PyObject* PyStructSequence_GetItem(PyObject *p, Py_ssize_t pos)
212220

Doc/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@
141141
('c:type', 'size_t'),
142142
('c:type', 'ssize_t'),
143143
('c:type', 'time_t'),
144+
('c:type', 'uint32_t'),
144145
('c:type', 'uint64_t'),
145146
('c:type', 'uintmax_t'),
146147
('c:type', 'uintptr_t'),

Doc/data/stable_abi.dat

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ Pending Removal in Python 3.16
55
:class:`array.array` ``'u'`` type (:c:type:`wchar_t`):
66
use the ``'w'`` type instead (``Py_UCS4``).
77

8+
* :mod:`builtins`:
9+
``~bool``, bitwise inversion on bool.
10+
811
* :mod:`symtable`:
912
Deprecate :meth:`symtable.Class.get_methods` due to the lack of interest.
1013
(Contributed by Bénédikt Tran in :gh:`119698`.)
14+
15+
* :mod:`shutil`: Deprecate :class:`!shutil.ExecError`, which hasn't
16+
been raised by any :mod:`!shutil` function since Python 3.4. It's
17+
now an alias for :exc:`RuntimeError`.
18+

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ although there is currently no date scheduled for their removal.
1111

1212
* :mod:`builtins`:
1313

14-
* ``~bool``, bitwise inversion on bool.
1514
* ``bool(NotImplemented)``.
1615
* Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
1716
signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,

Doc/glossary.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -590,14 +590,12 @@ Glossary
590590
which ships with the standard distribution of Python.
591591

592592
immortal
593-
If an object is immortal, its reference count is never modified, and
594-
therefore it is never deallocated.
593+
*Immortal objects* are a CPython implementation detail introduced
594+
in :pep:`683`.
595595

596-
Built-in strings and singletons are immortal objects. For example,
597-
:const:`True` and :const:`None` singletons are immortal.
598-
599-
See `PEP 683 – Immortal Objects, Using a Fixed Refcount
600-
<https://peps.python.org/pep-0683/>`_ for more information.
596+
If an object is immortal, its :term:`reference count` is never modified,
597+
and therefore it is never deallocated while the interpreter is running.
598+
For example, :const:`True` and :const:`None` are immortal in CPython.
601599

602600
immutable
603601
An object with a fixed value. Immutable objects include numbers, strings and

Doc/library/dis.rst

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ interpreter.
5656
for jump targets and exception handlers. The ``-O`` command line
5757
option and the ``show_offsets`` argument were added.
5858

59+
.. versionchanged:: 3.14
60+
The :option:`-P <dis --show-positions>` command-line option
61+
and the ``show_positions`` argument were added.
62+
5963
Example: Given the function :func:`!myfunc`::
6064

6165
def myfunc(alist):
@@ -85,7 +89,7 @@ The :mod:`dis` module can be invoked as a script from the command line:
8589

8690
.. code-block:: sh
8791
88-
python -m dis [-h] [-C] [-O] [infile]
92+
python -m dis [-h] [-C] [-O] [-P] [infile]
8993
9094
The following options are accepted:
9195

@@ -103,6 +107,10 @@ The following options are accepted:
103107

104108
Show offsets of instructions.
105109

110+
.. cmdoption:: -P, --show-positions
111+
112+
Show positions of instructions in the source code.
113+
106114
If :file:`infile` is specified, its disassembled code will be written to stdout.
107115
Otherwise, disassembly is performed on compiled source code received from stdin.
108116

@@ -116,7 +124,8 @@ The bytecode analysis API allows pieces of Python code to be wrapped in a
116124
code.
117125

118126
.. class:: Bytecode(x, *, first_line=None, current_offset=None,\
119-
show_caches=False, adaptive=False, show_offsets=False)
127+
show_caches=False, adaptive=False, show_offsets=False,\
128+
show_positions=False)
120129

121130
Analyse the bytecode corresponding to a function, generator, asynchronous
122131
generator, coroutine, method, string of source code, or a code object (as
@@ -144,6 +153,9 @@ code.
144153
If *show_offsets* is ``True``, :meth:`.dis` will include instruction
145154
offsets in the output.
146155

156+
If *show_positions* is ``True``, :meth:`.dis` will include instruction
157+
source code positions in the output.
158+
147159
.. classmethod:: from_traceback(tb, *, show_caches=False)
148160

149161
Construct a :class:`Bytecode` instance from the given traceback, setting
@@ -173,6 +185,12 @@ code.
173185
.. versionchanged:: 3.11
174186
Added the *show_caches* and *adaptive* parameters.
175187

188+
.. versionchanged:: 3.13
189+
Added the *show_offsets* parameter
190+
191+
.. versionchanged:: 3.14
192+
Added the *show_positions* parameter.
193+
176194
Example:
177195

178196
.. doctest::
@@ -226,7 +244,8 @@ operation is being performed, so the intermediate analysis object isn't useful:
226244
Added *file* parameter.
227245

228246

229-
.. function:: dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False)
247+
.. function:: dis(x=None, *, file=None, depth=None, show_caches=False,\
248+
adaptive=False, show_offsets=False, show_positions=False)
230249

231250
Disassemble the *x* object. *x* can denote either a module, a class, a
232251
method, a function, a generator, an asynchronous generator, a coroutine,
@@ -265,9 +284,14 @@ operation is being performed, so the intermediate analysis object isn't useful:
265284
.. versionchanged:: 3.11
266285
Added the *show_caches* and *adaptive* parameters.
267286

287+
.. versionchanged:: 3.13
288+
Added the *show_offsets* parameter.
289+
290+
.. versionchanged:: 3.14
291+
Added the *show_positions* parameter.
268292

269-
.. function:: distb(tb=None, *, file=None, show_caches=False, adaptive=False,
270-
show_offset=False)
293+
.. function:: distb(tb=None, *, file=None, show_caches=False, adaptive=False,\
294+
show_offset=False, show_positions=False)
271295

272296
Disassemble the top-of-stack function of a traceback, using the last
273297
traceback if none was passed. The instruction causing the exception is
@@ -285,14 +309,19 @@ operation is being performed, so the intermediate analysis object isn't useful:
285309
.. versionchanged:: 3.13
286310
Added the *show_offsets* parameter.
287311

312+
.. versionchanged:: 3.14
313+
Added the *show_positions* parameter.
314+
288315
.. function:: disassemble(code, lasti=-1, *, file=None, show_caches=False, adaptive=False)
289-
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,
290-
show_offsets=False)
316+
disco(code, lasti=-1, *, file=None, show_caches=False, adaptive=False,\
317+
show_offsets=False, show_positions=False)
291318
292319
Disassemble a code object, indicating the last instruction if *lasti* was
293320
provided. The output is divided in the following columns:
294321

295-
#. the line number, for the first instruction of each line
322+
#. the source code location of the instruction. Complete location information
323+
is shown if *show_positions* is true. Otherwise (the default) only the
324+
line number is displayed.
296325
#. the current instruction, indicated as ``-->``,
297326
#. a labelled instruction, indicated with ``>>``,
298327
#. the address of the instruction,
@@ -315,6 +344,9 @@ operation is being performed, so the intermediate analysis object isn't useful:
315344
.. versionchanged:: 3.13
316345
Added the *show_offsets* parameter.
317346

347+
.. versionchanged:: 3.14
348+
Added the *show_positions* parameter.
349+
318350
.. function:: get_instructions(x, *, first_line=None, show_caches=False, adaptive=False)
319351

320352
Return an iterator over the instructions in the supplied function, method,

0 commit comments

Comments
 (0)