Skip to content

Commit 1277a34

Browse files
authored
Merge branch '3.12' into bp-e85f2f1703e0f79cfd0d0e3010190b71c0eb18da
2 parents 019dbb5 + 6c9b7e5 commit 1277a34

File tree

79 files changed

+1012
-301
lines changed

Some content is hidden

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

79 files changed

+1012
-301
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
name: 'Check if generated files are up to date'
143143
# Don't use ubuntu-latest but a specific version to make the job
144144
# reproducible: to get the same tools versions (autoconf, aclocal, ...)
145-
runs-on: ubuntu-22.04
145+
runs-on: ubuntu-24.04
146146
timeout-minutes: 60
147147
needs: check_source
148148
if: needs.check_source.outputs.run_tests == 'true'
@@ -295,7 +295,7 @@ jobs:
295295
strategy:
296296
fail-fast: false
297297
matrix:
298-
os: [ubuntu-22.04]
298+
os: [ubuntu-24.04]
299299
openssl_ver: [3.0.15, 3.1.7, 3.2.3, 3.3.2]
300300
env:
301301
OPENSSL_VER: ${{ matrix.openssl_ver }}
@@ -349,7 +349,7 @@ jobs:
349349

350350
test_hypothesis:
351351
name: "Hypothesis tests on Ubuntu"
352-
runs-on: ubuntu-22.04
352+
runs-on: ubuntu-24.04
353353
timeout-minutes: 60
354354
needs: check_source
355355
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
@@ -468,6 +468,9 @@ jobs:
468468
timeout-minutes: 60
469469
needs: check_source
470470
if: needs.check_source.outputs.run_tests == 'true'
471+
strategy:
472+
matrix:
473+
os: [ubuntu-24.04]
471474
env:
472475
OPENSSL_VER: 3.0.15
473476
PYTHONSTRICTEXTENSIONBUILD: 1

.github/workflows/posix-deps-apt.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ apt-get -yq install \
1616
libgdbm-compat-dev \
1717
liblzma-dev \
1818
libncurses5-dev \
19+
libnsl-dev \
1920
libreadline6-dev \
2021
libsqlite3-dev \
2122
libssl-dev \

.github/workflows/reusable-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
# Run "doctest" on HEAD as new syntax doesn't exist in the latest stable release
9797
doctest:
9898
name: 'Doctest'
99-
runs-on: ubuntu-22.04
99+
runs-on: ubuntu-24.04
100100
timeout-minutes: 60
101101
steps:
102102
- uses: actions/checkout@v4

.github/workflows/reusable-tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313
jobs:
1414
build_tsan_reusable:
1515
name: 'Thread sanitizer'
16-
runs-on: ubuntu-22.04
16+
runs-on: ubuntu-24.04
1717
timeout-minutes: 60
1818
env:
1919
OPTIONS: ${{ inputs.options }}

.github/workflows/reusable-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
strategy:
2121
fail-fast: false
2222
matrix:
23-
os: [ubuntu-22.04]
23+
os: [ubuntu-24.04]
2424
env:
2525
OPENSSL_VER: 3.0.15
2626
PYTHONSTRICTEXTENSIONBUILD: 1

Doc/about.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
=====================
2-
About these documents
3-
=====================
1+
========================
2+
About this documentation
3+
========================
44

55

6-
These documents are generated from `reStructuredText`_ sources by `Sphinx`_, a
7-
document processor specifically written for the Python documentation.
6+
Python's documentation is generated from `reStructuredText`_ sources
7+
using `Sphinx`_, a documentation generator originally created for Python
8+
and now maintained as an independent project.
89

910
.. _reStructuredText: https://docutils.sourceforge.io/rst.html
1011
.. _Sphinx: https://www.sphinx-doc.org/
@@ -20,14 +21,14 @@ volunteers are always welcome!
2021
Many thanks go to:
2122

2223
* Fred L. Drake, Jr., the creator of the original Python documentation toolset
23-
and writer of much of the content;
24+
and author of much of the content;
2425
* the `Docutils <https://docutils.sourceforge.io/>`_ project for creating
2526
reStructuredText and the Docutils suite;
2627
* Fredrik Lundh for his Alternative Python Reference project from which Sphinx
2728
got many good ideas.
2829

2930

30-
Contributors to the Python Documentation
31+
Contributors to the Python documentation
3132
----------------------------------------
3233

3334
Many people have contributed to the Python language, the Python standard

Doc/c-api/arg.rst

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,24 @@ There are three ways strings and buffers can be converted to C:
229229
Numbers
230230
-------
231231

232+
These formats allow representing Python numbers or single characters as C numbers.
233+
Formats that require :class:`int`, :class:`float` or :class:`complex` can
234+
also use the corresponding special methods :meth:`~object.__index__`,
235+
:meth:`~object.__float__` or :meth:`~object.__complex__` to convert
236+
the Python object to the required type.
237+
238+
For signed integer formats, :exc:`OverflowError` is raised if the value
239+
is out of range for the C type.
240+
For unsigned integer formats, no range checking is done --- the
241+
most significant bits are silently truncated when the receiving field is too
242+
small to receive the value.
243+
232244
``b`` (:class:`int`) [unsigned char]
233-
Convert a nonnegative Python integer to an unsigned tiny int, stored in a C
245+
Convert a nonnegative Python integer to an unsigned tiny integer, stored in a C
234246
:c:expr:`unsigned char`.
235247

236248
``B`` (:class:`int`) [unsigned char]
237-
Convert a Python integer to a tiny int without overflow checking, stored in a C
249+
Convert a Python integer to a tiny integer without overflow checking, stored in a C
238250
:c:expr:`unsigned char`.
239251

240252
``h`` (:class:`int`) [short int]
@@ -307,7 +319,7 @@ Other objects
307319

308320
.. _o_ampersand:
309321

310-
``O&`` (object) [*converter*, *anything*]
322+
``O&`` (object) [*converter*, *address*]
311323
Convert a Python object to a C variable through a *converter* function. This
312324
takes two arguments: the first is a function, the second is the address of a C
313325
variable (of arbitrary type), converted to :c:expr:`void *`. The *converter*
@@ -321,14 +333,20 @@ Other objects
321333
the conversion has failed. When the conversion fails, the *converter* function
322334
should raise an exception and leave the content of *address* unmodified.
323335

324-
If the *converter* returns ``Py_CLEANUP_SUPPORTED``, it may get called a
336+
.. c:macro:: Py_CLEANUP_SUPPORTED
337+
:no-typesetting:
338+
339+
If the *converter* returns :c:macro:`!Py_CLEANUP_SUPPORTED`, it may get called a
325340
second time if the argument parsing eventually fails, giving the converter a
326341
chance to release any memory that it had already allocated. In this second
327342
call, the *object* parameter will be ``NULL``; *address* will have the same value
328343
as in the original call.
329344

345+
Examples of converters: :c:func:`PyUnicode_FSConverter` and
346+
:c:func:`PyUnicode_FSDecoder`.
347+
330348
.. versionchanged:: 3.1
331-
``Py_CLEANUP_SUPPORTED`` was added.
349+
:c:macro:`!Py_CLEANUP_SUPPORTED` was added.
332350

333351
``p`` (:class:`bool`) [int]
334352
Tests the value passed in for truth (a boolean **p**\ redicate) and converts
@@ -344,12 +362,6 @@ Other objects
344362
in *items*. The C arguments must correspond to the individual format units in
345363
*items*. Format units for sequences may be nested.
346364

347-
It is possible to pass "long" integers (integers whose value exceeds the
348-
platform's :c:macro:`LONG_MAX`) however no proper range checking is done --- the
349-
most significant bits are silently truncated when the receiving field is too
350-
small to receive the value (actually, the semantics are inherited from downcasts
351-
in C --- your mileage may vary).
352-
353365
A few other characters have a meaning in a format string. These may not occur
354366
inside nested parentheses. They are:
355367

Doc/c-api/object.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,13 @@ Object Protocol
393393
on failure. This is equivalent to the Python statement ``del o[key]``.
394394
395395
396+
.. c:function:: int PyObject_DelItemString(PyObject *o, const char *key)
397+
398+
This is the same as :c:func:`PyObject_DelItem`, but *key* is
399+
specified as a :c:expr:`const char*` UTF-8 encoded bytes string,
400+
rather than a :c:expr:`PyObject*`.
401+
402+
396403
.. c:function:: PyObject* PyObject_Dir(PyObject *o)
397404
398405
This is equivalent to the Python expression ``dir(o)``, returning a (possibly

Doc/c-api/typeobj.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ slot typedefs
355355
+-----------------------------+-----------------------------+----------------------+
356356
| :c:type:`newfunc` | .. line-block:: | :c:type:`PyObject` * |
357357
| | | |
358-
| | :c:type:`PyObject` * | |
358+
| | :c:type:`PyTypeObject` * | |
359359
| | :c:type:`PyObject` * | |
360360
| | :c:type:`PyObject` * | |
361361
+-----------------------------+-----------------------------+----------------------+
@@ -2610,7 +2610,7 @@ Slot Type typedefs
26102610
26112611
See :c:member:`~PyTypeObject.tp_free`.
26122612

2613-
.. c:type:: PyObject *(*newfunc)(PyObject *, PyObject *, PyObject *)
2613+
.. c:type:: PyObject *(*newfunc)(PyTypeObject *, PyObject *, PyObject *)
26142614
26152615
See :c:member:`~PyTypeObject.tp_new`.
26162616

Doc/c-api/unicode.rst

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -770,33 +770,52 @@ Functions encoding to and decoding from the :term:`filesystem encoding and
770770
error handler` (:pep:`383` and :pep:`529`).
771771
772772
To encode file names to :class:`bytes` during argument parsing, the ``"O&"``
773-
converter should be used, passing :c:func:`PyUnicode_FSConverter` as the
773+
converter should be used, passing :c:func:`!PyUnicode_FSConverter` as the
774774
conversion function:
775775
776776
.. c:function:: int PyUnicode_FSConverter(PyObject* obj, void* result)
777777
778-
ParseTuple converter: encode :class:`str` objects -- obtained directly or
778+
:ref:`PyArg_Parse\* converter <arg-parsing>`: encode :class:`str` objects -- obtained directly or
779779
through the :class:`os.PathLike` interface -- to :class:`bytes` using
780780
:c:func:`PyUnicode_EncodeFSDefault`; :class:`bytes` objects are output as-is.
781-
*result* must be a :c:expr:`PyBytesObject*` which must be released when it is
782-
no longer used.
781+
*result* must be an address of a C variable of type :c:expr:`PyObject*`
782+
(or :c:expr:`PyBytesObject*`).
783+
On success, set the variable to a new :term:`strong reference` to
784+
a :ref:`bytes object <bytesobjects>` which must be released
785+
when it is no longer used and return a non-zero value
786+
(:c:macro:`Py_CLEANUP_SUPPORTED`).
787+
Embedded null bytes are not allowed in the result.
788+
On failure, return ``0`` with an exception set.
789+
790+
If *obj* is ``NULL``, the function releases a strong reference
791+
stored in the variable referred by *result* and returns ``1``.
783792
784793
.. versionadded:: 3.1
785794
786795
.. versionchanged:: 3.6
787796
Accepts a :term:`path-like object`.
788797
789798
To decode file names to :class:`str` during argument parsing, the ``"O&"``
790-
converter should be used, passing :c:func:`PyUnicode_FSDecoder` as the
799+
converter should be used, passing :c:func:`!PyUnicode_FSDecoder` as the
791800
conversion function:
792801
793802
.. c:function:: int PyUnicode_FSDecoder(PyObject* obj, void* result)
794803
795-
ParseTuple converter: decode :class:`bytes` objects -- obtained either
804+
:ref:`PyArg_Parse\* converter <arg-parsing>`: decode :class:`bytes` objects -- obtained either
796805
directly or indirectly through the :class:`os.PathLike` interface -- to
797806
:class:`str` using :c:func:`PyUnicode_DecodeFSDefaultAndSize`; :class:`str`
798-
objects are output as-is. *result* must be a :c:expr:`PyUnicodeObject*` which
799-
must be released when it is no longer used.
807+
objects are output as-is.
808+
*result* must be an address of a C variable of type :c:expr:`PyObject*`
809+
(or :c:expr:`PyUnicodeObject*`).
810+
On success, set the variable to a new :term:`strong reference` to
811+
a :ref:`Unicode object <unicodeobjects>` which must be released
812+
when it is no longer used and return a non-zero value
813+
(:c:macro:`Py_CLEANUP_SUPPORTED`).
814+
Embedded null characters are not allowed in the result.
815+
On failure, return ``0`` with an exception set.
816+
817+
If *obj* is ``NULL``, release the strong reference
818+
to the object referred to by *result* and return ``1``.
800819
801820
.. versionadded:: 3.2
802821

0 commit comments

Comments
 (0)