Skip to content

Commit ac550ef

Browse files
committed
Merge remote-tracking branch 'upstream/main' into fix-issue-25872
2 parents 78897e7 + f32c795 commit ac550ef

File tree

368 files changed

+11608
-8824
lines changed

Some content is hidden

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

368 files changed

+11608
-8824
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ jobs:
177177
strategy:
178178
fail-fast: false
179179
matrix:
180-
openssl_ver: [1.1.1k, 3.0.0-alpha15]
180+
openssl_ver: [1.1.1k, 3.0.0-alpha16]
181181
env:
182182
OPENSSL_VER: ${{ matrix.openssl_ver }}
183183
MULTISSL_DIR: ${{ github.workspace }}/multissl

Doc/c-api/apiabiversion.rst

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,57 @@
66
API and ABI Versioning
77
***********************
88

9-
``PY_VERSION_HEX`` is the Python version number encoded in a single integer.
10-
11-
For example if the ``PY_VERSION_HEX`` is set to ``0x030401a2``, the underlying
12-
version information can be found by treating it as a 32 bit number in
13-
the following manner:
14-
15-
+-------+-------------------------+------------------------------------------------+
16-
| Bytes | Bits (big endian order) | Meaning |
17-
+=======+=========================+================================================+
18-
| ``1`` | ``1-8`` | ``PY_MAJOR_VERSION`` (the ``3`` in |
19-
| | | ``3.4.1a2``) |
20-
+-------+-------------------------+------------------------------------------------+
21-
| ``2`` | ``9-16`` | ``PY_MINOR_VERSION`` (the ``4`` in |
22-
| | | ``3.4.1a2``) |
23-
+-------+-------------------------+------------------------------------------------+
24-
| ``3`` | ``17-24`` | ``PY_MICRO_VERSION`` (the ``1`` in |
25-
| | | ``3.4.1a2``) |
26-
+-------+-------------------------+------------------------------------------------+
27-
| ``4`` | ``25-28`` | ``PY_RELEASE_LEVEL`` (``0xA`` for alpha, |
28-
| | | ``0xB`` for beta, ``0xC`` for release |
29-
| | | candidate and ``0xF`` for final), in this |
30-
| | | case it is alpha. |
31-
+-------+-------------------------+------------------------------------------------+
32-
| | ``29-32`` | ``PY_RELEASE_SERIAL`` (the ``2`` in |
33-
| | | ``3.4.1a2``, zero for final releases) |
34-
+-------+-------------------------+------------------------------------------------+
35-
36-
Thus ``3.4.1a2`` is hexversion ``0x030401a2``.
9+
CPython exposes its version number in the following macros.
10+
Note that these correspond to the version code is **built** with,
11+
not necessarily the version used at **run time**.
3712

38-
All the given macros are defined in :source:`Include/patchlevel.h`.
13+
See :ref:`stable` for a discussion of API and ABI stability across versions.
14+
15+
.. c:macro:: PY_MAJOR_VERSION
16+
17+
The ``3`` in ``3.4.1a2``.
18+
19+
.. c:macro:: PY_MINOR_VERSION
20+
21+
The ``4`` in ``3.4.1a2``.
22+
23+
.. c:macro:: PY_MICRO_VERSION
24+
25+
The ``1`` in ``3.4.1a2``.
26+
27+
.. c:macro:: PY_RELEASE_LEVEL
28+
29+
The ``a`` in ``3.4.1a2``.
30+
This can be ``0xA`` for alpha, ``0xB`` for beta, ``0xC`` for release
31+
candidate or ``0xF`` for final.
3932

33+
.. c:macro:: PY_RELEASE_SERIAL
34+
35+
The ``2`` in ``3.4.1a2``. Zero for final releases.
36+
37+
.. c:macro:: PY_VERSION_HEX
38+
39+
The Python version number encoded in a single integer.
40+
41+
The underlying version information can be found by treating it as a 32 bit
42+
number in the following manner:
43+
44+
+-------+-------------------------+-------------------------+--------------------------+
45+
| Bytes | Bits (big endian order) | Meaning | Value for ``3.4.1a2`` |
46+
+=======+=========================+=========================+==========================+
47+
| 1 | 1-8 | ``PY_MAJOR_VERSION`` | ``0x03`` |
48+
+-------+-------------------------+-------------------------+--------------------------+
49+
| 2 | 9-16 | ``PY_MINOR_VERSION`` | ``0x04`` |
50+
+-------+-------------------------+-------------------------+--------------------------+
51+
| 3 | 17-24 | ``PY_MICRO_VERSION`` | ``0x01`` |
52+
+-------+-------------------------+-------------------------+--------------------------+
53+
| 4 | 25-28 | ``PY_RELEASE_LEVEL`` | ``0xA`` |
54+
+ +-------------------------+-------------------------+--------------------------+
55+
| | 29-32 | ``PY_RELEASE_SERIAL`` | ``0x2`` |
56+
+-------+-------------------------+-------------------------+--------------------------+
57+
58+
Thus ``3.4.1a2`` is hexversion ``0x030401a2`` and ``3.10.0`` is
59+
hexversion ``0x030a00f0``.
60+
61+
62+
All the given macros are defined in :source:`Include/patchlevel.h`.

Doc/c-api/exceptions.rst

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -675,27 +675,6 @@ The following functions are used to create and modify Unicode exceptions from C.
675675
*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are
676676
UTF-8 encoded strings.
677677
678-
.. c:function:: PyObject* PyUnicodeEncodeError_Create(const char *encoding, const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason)
679-
680-
Create a :class:`UnicodeEncodeError` object with the attributes *encoding*,
681-
*object*, *length*, *start*, *end* and *reason*. *encoding* and *reason* are
682-
UTF-8 encoded strings.
683-
684-
.. deprecated:: 3.3 3.11
685-
686-
``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to
687-
``PyObject_CallFunction(PyExc_UnicodeEncodeError, "sOnns", ...)``.
688-
689-
.. c:function:: PyObject* PyUnicodeTranslateError_Create(const Py_UNICODE *object, Py_ssize_t length, Py_ssize_t start, Py_ssize_t end, const char *reason)
690-
691-
Create a :class:`UnicodeTranslateError` object with the attributes *object*,
692-
*length*, *start*, *end* and *reason*. *reason* is a UTF-8 encoded string.
693-
694-
.. deprecated:: 3.3 3.11
695-
696-
``Py_UNICODE`` is deprecated since Python 3.3. Please migrate to
697-
``PyObject_CallFunction(PyExc_UnicodeTranslateError, "Onns", ...)``.
698-
699678
.. c:function:: PyObject* PyUnicodeDecodeError_GetEncoding(PyObject *exc)
700679
PyObject* PyUnicodeEncodeError_GetEncoding(PyObject *exc)
701680

Doc/c-api/init.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,11 @@ Process-wide parameters
323323
single: main()
324324
triple: stdin; stdout; sdterr
325325
326+
This API is kept for backward compatibility: setting
327+
:c:member:`PyConfig.stdio_encoding` and :c:member:`PyConfig.stdio_errors`
328+
should be used instead, see :ref:`Python Initialization Configuration
329+
<init-config>`.
330+
326331
This function should be called before :c:func:`Py_Initialize`, if it is
327332
called at all. It specifies which encoding and error handling to use
328333
with standard IO, with the same meanings as in :func:`str.encode`.
@@ -345,6 +350,8 @@ Process-wide parameters
345350
346351
.. versionadded:: 3.4
347352
353+
.. deprecated:: 3.11
354+
348355
349356
.. c:function:: void Py_SetProgramName(const wchar_t *name)
350357
@@ -353,6 +360,10 @@ Process-wide parameters
353360
single: main()
354361
single: Py_GetPath()
355362
363+
This API is kept for backward compatibility: setting
364+
:c:member:`PyConfig.program_name` should be used instead, see :ref:`Python
365+
Initialization Configuration <init-config>`.
366+
356367
This function should be called before :c:func:`Py_Initialize` is called for
357368
the first time, if it is called at all. It tells the interpreter the value
358369
of the ``argv[0]`` argument to the :c:func:`main` function of the program
@@ -367,6 +378,8 @@ Process-wide parameters
367378
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
368379
:c:type:`wchar_*` string.
369380
381+
.. deprecated:: 3.11
382+
370383
371384
.. c:function:: wchar* Py_GetProgramName()
372385
@@ -495,6 +508,11 @@ Process-wide parameters
495508
single: path (in module sys)
496509
single: Py_GetPath()
497510
511+
This API is kept for backward compatibility: setting
512+
:c:member:`PyConfig.module_search_paths` and
513+
:c:member:`PyConfig.module_search_paths_set` should be used instead, see
514+
:ref:`Python Initialization Configuration <init-config>`.
515+
498516
Set the default module search path. If this function is called before
499517
:c:func:`Py_Initialize`, then :c:func:`Py_GetPath` won't attempt to compute a
500518
default search path but uses the one provided instead. This is useful if
@@ -518,6 +536,8 @@ Process-wide parameters
518536
The program full path is now used for :data:`sys.executable`, instead
519537
of the program name.
520538
539+
.. deprecated:: 3.11
540+
521541
522542
.. c:function:: const char* Py_GetVersion()
523543
@@ -617,6 +637,9 @@ Process-wide parameters
617637
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
618638
:c:type:`wchar_*` string.
619639

640+
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
641+
members of the :ref:`Python Initialization Configuration <init-config>`.
642+
620643
.. note::
621644
It is recommended that applications embedding the Python interpreter
622645
for purposes other than executing a single script pass ``0`` as *updatepath*,
@@ -644,11 +667,18 @@ Process-wide parameters
644667
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
645668
:c:type:`wchar_*` string.
646669
670+
See also :c:member:`PyConfig.orig_argv` and :c:member:`PyConfig.argv`
671+
members of the :ref:`Python Initialization Configuration <init-config>`.
672+
647673
.. versionchanged:: 3.4 The *updatepath* value depends on :option:`-I`.
648674
649675
650676
.. c:function:: void Py_SetPythonHome(const wchar_t *home)
651677
678+
This API is kept for backward compatibility: setting
679+
:c:member:`PyConfig.home` should be used instead, see :ref:`Python
680+
Initialization Configuration <init-config>`.
681+
652682
Set the default "home" directory, that is, the location of the standard
653683
Python libraries. See :envvar:`PYTHONHOME` for the meaning of the
654684
argument string.
@@ -661,6 +691,8 @@ Process-wide parameters
661691
Use :c:func:`Py_DecodeLocale` to decode a bytes string to get a
662692
:c:type:`wchar_*` string.
663693
694+
.. deprecated:: 3.11
695+
664696
665697
.. c:function:: w_char* Py_GetPythonHome()
666698

Doc/c-api/memory.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,8 @@ Customize Memory Allocators
476476
the :c:func:`PyMem_SetupDebugHooks` function must be called to reinstall the
477477
debug hooks on top on the new allocator.
478478
479+
See also :c:member:`PyPreConfig.allocator` and :ref:`Preinitialize Python
480+
with PyPreConfig <c-preinit>`.
479481
480482
.. c:function:: void PyMem_SetupDebugHooks(void)
481483

0 commit comments

Comments
 (0)