Skip to content

Commit 0bf4083

Browse files
Merge branch 'main' into gh-110131-argparse-append-default
2 parents 844bb63 + 10b2d12 commit 0bf4083

244 files changed

Lines changed: 10023 additions & 5832 deletions

File tree

Some content is hidden

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

‎.github/dependabot.yml‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ updates:
77
labels:
88
- "skip issue"
99
- "skip news"
10-
ignore:
11-
- dependency-name: "*"
12-
update-types:
13-
- "version-update:semver-minor"
14-
- "version-update:semver-patch"
1510
groups:
1611
actions:
1712
patterns:

‎.github/workflows/require-pr-label.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ jobs:
6262
count: 1
6363
labels: |
6464
awaiting merge
65+
message: >-
66+
This PR is labelled type-feature. All features require approval from a
67+
core team member before merge. Found: {{ applied }}

‎Doc/c-api/init_config.rst‎

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -116,15 +116,14 @@ Error Handling
116116
117117
Get the *config* exit code.
118118
119-
* Set *\*exitcode* and return ``1`` if *config* has an exit code set.
120-
* Return ``0`` if *config* has no exit code set.
119+
Return ``0`` and leave *\*exitcode* unchanged.
121120
122-
Only the ``Py_InitializeFromInitConfig()`` function can set an exit
123-
code if the ``parse_argv`` option is non-zero.
121+
In Python 3.15, :c:func:`Py_InitializeFromInitConfig` sets an exit code if a
122+
command line option wants to exit Python. This is no longer the case in
123+
Python 3.16. Instead, the option is now processed in :c:func:`Py_RunMain`.
124+
This function became useless.
124125
125-
An exit code can be set when parsing the command line failed (exit
126-
code ``2``) or when a command line option asks to display the command
127-
line help (exit code ``0``).
126+
.. deprecated:: next
128127
129128
130129
Get Options
@@ -247,10 +246,11 @@ Initialize Python
247246
248247
* Return ``0`` on success.
249248
* Set an error in *config* and return ``-1`` on error.
250-
* Set an exit code in *config* and return ``-1`` if Python wants to
251-
exit.
252249
253-
See ``PyInitConfig_GetExitcode()`` for the exit code case.
250+
.. versionchanged:: next
251+
The function no longer sets an exit code if a command line option wants
252+
to exit Python. Instead, the option is now processed in
253+
:c:func:`Py_RunMain`.
254254
255255
256256
.. _pyinitconfig-opts:
@@ -690,9 +690,6 @@ Example of customized Python always running in isolated mode::
690690
691691
exception:
692692
PyConfig_Clear(&config);
693-
if (PyStatus_IsExit(status)) {
694-
return status.exitcode;
695-
}
696693
/* Display the error message and exit the process with
697694
non-zero exit code */
698695
Py_ExitStatusException(status);
@@ -758,6 +755,8 @@ PyStatus
758755
759756
Exit code. Argument passed to ``exit()``.
760757
758+
.. deprecated:: next
759+
761760
.. c:member:: const char *err_msg
762761
763762
Error message.
@@ -788,6 +787,11 @@ PyStatus
788787
789788
Exit Python with the specified exit code.
790789
790+
.. deprecated:: next
791+
:c:func:`Py_InitializeFromConfig` no longer sets an exit code if a
792+
command line option wants to exit Python. Instead, the option is
793+
now processed in :c:func:`Py_RunMain`.
794+
791795
Functions to handle a status:
792796
793797
.. c:function:: int PyStatus_Exception(PyStatus status)
@@ -803,6 +807,11 @@ PyStatus
803807
804808
Is the result an exit?
805809
810+
.. deprecated:: next
811+
:c:func:`Py_InitializeFromConfig` no longer sets an exit code if a
812+
command line option wants to exit Python. Instead, the option is
813+
now processed in :c:func:`Py_RunMain`.
814+
806815
.. c:function:: void Py_ExitStatusException(PyStatus status)
807816
808817
Call ``exit(exitcode)`` if *status* is an exit. Print the error

‎Doc/c-api/interp-lifecycle.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ Initializing and finalizing the interpreter
127127
interpreter, populating the runtime configuration structure, and querying
128128
the returned status structure.
129129
130+
.. versionchanged:: next
131+
The function no longer returns an exit code if a command line option
132+
wants to exit Python. Instead, the option is processed in
133+
:c:func:`Py_RunMain`.
134+
130135
131136
.. c:function:: int Py_IsInitialized()
132137

‎Doc/c-api/slice.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Slice Objects
5353
length *length*, and store the length of the slice in *slicelength*. Out
5454
of bounds indices are clipped in a manner consistent with the handling of
5555
normal slices.
56+
*length* must not be negative.
5657
5758
Return ``0`` on success and ``-1`` on error with an exception set.
5859
@@ -108,6 +109,10 @@ Slice Objects
108109
Out of bounds indices are clipped in a manner consistent with the handling
109110
of normal slices.
110111
112+
*length* must not be negative.
113+
*step* must not be zero and must not be less than ``-PY_SSIZE_T_MAX``,
114+
as guaranteed by :c:func:`PySlice_Unpack`.
115+
111116
Return the length of the slice. Always successful. Doesn't call Python
112117
code.
113118

‎Doc/conf.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,10 @@
469469
# https://github.com/sphinx-doc/sphinx/issues/12359
470470
epub_use_index = False
471471

472+
# The default depth of 3 lists over a thousand entries, which makes the
473+
# table of contents hard to navigate in e-book readers
474+
epub_tocdepth = 2
475+
472476
# translation tag
473477
# ---------------
474478

‎Doc/howto/free-threading-python.rst‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,7 @@ The free-threaded build of CPython aims to provide similar thread-safety
7979
behavior at the Python level to the default GIL-enabled build. Built-in
8080
types like :class:`dict`, :class:`list`, and :class:`set` use internal locks
8181
to protect against concurrent modifications in ways that behave similarly to
82-
the GIL. However, Python has not historically guaranteed specific behavior for
83-
concurrent modifications to these built-in types, so this should be treated
84-
as a description of the current implementation, not a guarantee of current or
85-
future behavior.
82+
the GIL. See :ref:`threadsafety` for the guarantees provided by built-in types.
8683

8784
.. note::
8885

‎Doc/library/argparse.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2103,7 +2103,7 @@ Mutual exclusion
21032103
>>> group.add_argument('--bar', action='store_false')
21042104
>>> parser.parse_args([])
21052105
usage: PROG [-h] (--foo | --bar)
2106-
PROG: error: one of the arguments --foo --bar is required
2106+
PROG: error: one of the following arguments is required: --foo, --bar
21072107

21082108
Note that currently mutually exclusive argument groups do not support the
21092109
*title* and *description* arguments of

‎Doc/library/ctypes.rst‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,6 +1755,9 @@ These prefabricated library loaders are available:
17551755
:c:expr:`int`, which is of course not always the truth, so you have to assign
17561756
the correct :attr:`!restype` attribute to use these functions.
17571757

1758+
Note that if the Python interpreter is statically linked, this will be
1759+
``None``, as ``dlopen`` is not possible in this case.
1760+
17581761
.. audit-event:: ctypes.dlopen name ctypes.LibraryLoader
17591762

17601763
Loading a library through any of these objects raises an

‎Doc/library/dis.rst‎

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,32 +1899,38 @@ iterations of the loop.
18991899

19001900
The operand determines which intrinsic function is called:
19011901

1902-
+------------------------------------------+-----------------------------------+
1903-
| Operand | Description |
1904-
+==========================================+===================================+
1905-
| ``INTRINSIC_2_INVALID`` | Not valid |
1906-
+------------------------------------------+-----------------------------------+
1907-
| ``INTRINSIC_PREP_RERAISE_STAR`` | Calculates the |
1908-
| | :exc:`ExceptionGroup` to raise |
1909-
| | from a ``try-except*``. |
1910-
+------------------------------------------+-----------------------------------+
1911-
| ``INTRINSIC_TYPEVAR_WITH_BOUND`` | Creates a :class:`typing.TypeVar` |
1912-
| | with a bound. |
1913-
+------------------------------------------+-----------------------------------+
1914-
| ``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS`` | Creates a |
1915-
| | :class:`typing.TypeVar` with |
1916-
| | constraints. |
1917-
+------------------------------------------+-----------------------------------+
1918-
| ``INTRINSIC_SET_FUNCTION_TYPE_PARAMS`` | Sets the ``__type_params__`` |
1919-
| | attribute of a function. |
1920-
+------------------------------------------+-----------------------------------+
1921-
| ``INTRINSIC_ADD_CONDITIONAL_ANNOTATION`` | Adds an annotation index to the |
1922-
| | ``__conditional_annotations__`` |
1923-
| | set. |
1924-
+------------------------------------------+-----------------------------------+
1902+
+------------------------------------------+-----------------------------------------+
1903+
| Operand | Description |
1904+
+==========================================+=========================================+
1905+
| ``INTRINSIC_2_INVALID`` | Not valid |
1906+
+------------------------------------------+-----------------------------------------+
1907+
| ``INTRINSIC_PREP_RERAISE_STAR`` | Calculates the |
1908+
| | :exc:`ExceptionGroup` to raise |
1909+
| | from a ``try-except*``. |
1910+
+------------------------------------------+-----------------------------------------+
1911+
| ``INTRINSIC_TYPEVAR_WITH_BOUND`` | Creates a :class:`typing.TypeVar` |
1912+
| | with a bound. |
1913+
+------------------------------------------+-----------------------------------------+
1914+
| ``INTRINSIC_TYPEVAR_WITH_CONSTRAINTS`` | Creates a |
1915+
| | :class:`typing.TypeVar` with |
1916+
| | constraints. |
1917+
+------------------------------------------+-----------------------------------------+
1918+
| ``INTRINSIC_SET_FUNCTION_TYPE_PARAMS`` | Sets the ``__type_params__`` |
1919+
| | attribute of a function. |
1920+
+------------------------------------------+-----------------------------------------+
1921+
| ``INTRINSIC_ADD_CONDITIONAL_ANNOTATION`` | Adds an annotation index to the |
1922+
| | ``__conditional_annotations__`` |
1923+
| | set. |
1924+
+------------------------------------------+-----------------------------------------+
1925+
| ``INTRINSIC_MATCH_CLASS_ISINSTANCE`` | Do :func:`isinstance` checks for |
1926+
| | :ref:`Class patterns <class-patterns>`. |
1927+
+------------------------------------------+-----------------------------------------+
19251928

19261929
.. versionadded:: 3.12
19271930

1931+
.. versionchanged:: 3.16
1932+
Added ``INTRINSIC_MATCH_CLASS_ISINSTANCE``.
1933+
19281934

19291935
.. opcode:: LOAD_SPECIAL
19301936

0 commit comments

Comments
 (0)