Skip to content

Commit 98fec06

Browse files
committed
Merge remote-tracking branch 'upstream/main' into clinic-s-z-asutf8nonul
# Conflicts: # Modules/_ctypes/clinic/_ctypes.c.h # Modules/_io/clinic/fileio.c.h # Modules/_io/clinic/textio.c.h # Modules/_io/clinic/winconsoleio.c.h # Modules/_sqlite/clinic/connection.c.h # Modules/cjkcodecs/clinic/multibytecodec.c.h # Modules/clinic/_dbmmodule.c.h # Modules/clinic/_elementtree.c.h # Modules/clinic/_gdbmmodule.c.h # Modules/clinic/_pickle.c.h # Modules/clinic/_testclinic.c.h # Modules/clinic/_tkinter.c.h # Modules/clinic/arraymodule.c.h # Modules/clinic/posixmodule.c.h # Modules/clinic/pyexpat.c.h # Objects/clinic/memoryobject.c.h # Python/clinic/bltinmodule.c.h # Python/clinic/sysmodule.c.h
2 parents 7cf010a + 1c4fa4f commit 98fec06

132 files changed

Lines changed: 4134 additions & 3462 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.

‎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/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

‎Doc/library/optparse.rst‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ Choosing an argument parsing library
1616
The standard library includes three argument parsing libraries:
1717

1818
* :mod:`getopt`: a module that closely mirrors the procedural C ``getopt`` API.
19-
Included in the standard library since before the initial Python 1.0 release.
2019
* :mod:`!optparse`: a declarative replacement for ``getopt`` that
2120
provides equivalent functionality without requiring each application
22-
to implement its own procedural option parsing logic. Included
23-
in the standard library since the Python 2.3 release.
21+
to implement its own procedural option parsing logic.
2422
* :mod:`argparse`: a more opinionated alternative to ``optparse`` that
2523
provides more functionality by default, at the expense of reduced application
26-
flexibility in controlling exactly how arguments are processed. Included in
27-
the standard library since the Python 2.7 and Python 3.2 releases.
24+
flexibility in controlling exactly how arguments are processed.
2825

2926
In the absence of more specific argument parsing design constraints, :mod:`argparse`
3027
is the recommended choice for implementing command line applications, as it offers

‎Doc/library/turtle.rst‎

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2689,12 +2689,51 @@ These modified docstrings are created automatically together with the function
26892689
definitions that are derived from the methods at import time.
26902690

26912691

2692+
.. _turtle-docstring-translation:
2693+
26922694
Translation of docstrings into different languages
26932695
--------------------------------------------------
26942696

2695-
There is a utility to create a dictionary the keys of which are the method names
2696-
and the values of which are the docstrings of the public methods of the classes
2697-
Screen and Turtle.
2697+
The docstrings of the public methods of the Screen and Turtle classes, and of
2698+
the corresponding functions, can be replaced with translations, so that
2699+
:func:`help` and IDE tooltips are shown in another language. However, only the help
2700+
text is translated, the names of the functions and methods stay the same.
2701+
2702+
Translations are distributed on PyPI in the :pypi:`turtle-translations`
2703+
package. To use them, install the package with :program:`pip` and select the
2704+
language with the :envvar:`PYTHON_TURTLE_LANG` environment variable. For
2705+
example, to show the help text in Spanish:
2706+
2707+
.. code-block:: console
2708+
2709+
$ python -m pip install turtle-translations
2710+
$ PYTHON_TURTLE_LANG=es python
2711+
>>> import turtle
2712+
>>> help(turtle.forward)
2713+
2714+
The language can also be set permanently with the *language* entry of the
2715+
:file:`turtle.cfg` file (see :ref:`turtle-configuration`). If no translation
2716+
is found for the selected language, the English docstrings are kept.
2717+
2718+
To add a new language or improve an existing translation, see the
2719+
contribution instructions in the :pypi:`turtle-translations` project.
2720+
2721+
A translation is a docstring dictionary. It is a top-level module named
2722+
:samp:`turtle_docstringdict_{language}.py` on :data:`sys.path` defining a
2723+
dictionary named ``docsdict``, the keys of which are method names such as
2724+
``Turtle.forward`` and the values of which are the translated docstrings. It is
2725+
read in at import time. Entries naming a method which does not exist in the
2726+
running version are ignored.
2727+
2728+
.. versionchanged:: 3.16
2729+
Entries naming an unknown method are ignored instead of reported.
2730+
2731+
.. envvar:: PYTHON_TURTLE_LANG
2732+
2733+
The name of the language to read the translation for. It takes precedence
2734+
over the *language* entry of the :file:`turtle.cfg` file.
2735+
2736+
.. versionadded:: 3.16
26982737

26992738
.. function:: write_docstringdict(filename="turtle_docstringdict")
27002739

@@ -2706,17 +2745,8 @@ Screen and Turtle.
27062745
Python script :file:`{filename}.py`. It is intended to serve as a template
27072746
for translation of the docstrings into different languages.
27082747

2709-
If you (or your students) want to use :mod:`!turtle` with online help in your
2710-
native language, you have to translate the docstrings and save the resulting
2711-
file as e.g. :file:`turtle_docstringdict_german.py`.
2712-
2713-
If you have an appropriate entry in your :file:`turtle.cfg` file this dictionary
2714-
will be read in at import time and will replace the original English docstrings.
2715-
2716-
At the time of this writing there are docstring dictionaries in German and in
2717-
Italian. (Requests please to glingl@aon.at.)
2718-
27192748

2749+
.. _turtle-configuration:
27202750

27212751
How to configure Screen and Turtles
27222752
-----------------------------------
@@ -2767,9 +2797,9 @@ Short explanation of selected entries:
27672797
the cfg file).
27682798
- If you want to reflect the turtle its state, you have to use ``resizemode =
27692799
auto``.
2770-
- If you set e.g. ``language = italian`` the docstringdict
2771-
:file:`turtle_docstringdict_italian.py` will be loaded at import time (if
2772-
present on the import path, e.g. in the same directory as :mod:`!turtle`).
2800+
- The *language* entry selects the language of the docstrings, unless the
2801+
:envvar:`PYTHON_TURTLE_LANG` environment variable is set. See
2802+
:ref:`turtle-docstring-translation` for more information.
27732803
- The entries *exampleturtle* and *examplescreen* define the names of these
27742804
objects as they occur in the docstrings. The transformation of
27752805
method-docstrings to function-docstrings will delete these names from the

‎Doc/whatsnew/3.15.rst‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,21 +2030,18 @@ Upgraded experimental JIT compiler
20302030
----------------------------------
20312031

20322032
Results from the `pyperformance <https://github.com/python/pyperformance>`__
2033-
benchmark suite report
2034-
`8-9% <https://www.doesjitgobrrr.com/run/2026-04-29>`__
2033+
benchmark suite report a
2034+
`7-8% <https://www.doesjitgobrrr.com/run/2026-09-25>`__
20352035
geometric mean performance improvement for the JIT over the standard CPython
20362036
interpreter built with all optimizations enabled on x86-64 Linux. On AArch64
2037-
macOS, the JIT has a
2038-
`12-13% <https://www.doesjitgobrrr.com/run/2026-04-29>`__
2037+
macOS, the JIT has an
2038+
`11-12% <https://www.doesjitgobrrr.com/run/2026-09-25>`__
20392039
speedup over the :ref:`tail calling interpreter <whatsnew314-tail-call-interpreter>`
20402040
with all optimizations enabled. The speedups for JIT
20412041
builds versus no JIT builds range from roughly 15% slowdown to over
20422042
100% speedup (ignoring the ``unpack_sequence`` microbenchmark) on
20432043
x86-64 Linux and AArch64 macOS systems.
20442044

2045-
.. attention::
2046-
These results are not yet final.
2047-
20482045
The major upgrades to the JIT are:
20492046

20502047
* LLVM 21 build-time dependency

‎Doc/whatsnew/3.16.rst‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,16 @@ tkinter
712712
with no unit suffix to :class:`int` or :class:`float`.
713713
(Contributed by Serhiy Storchaka in :gh:`153513`.)
714714

715+
716+
turtle
717+
------
718+
719+
* Translations of the :mod:`turtle` docstrings are now distributed on PyPI
720+
in the :pypi:`turtle-translations` package. Additionally, added the
721+
:envvar:`PYTHON_TURTLE_LANG` environment variable to select the language.
722+
(Contributed by Stan Ulbrych in :gh:`156360`.)
723+
724+
715725
unicodedata
716726
-----------
717727

‎Include/internal/pycore_global_objects_fini_generated.h‎

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

‎Include/internal/pycore_global_strings.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ struct _Py_global_strings {
500500
STRUCT_FOR_ID(filter)
501501
STRUCT_FOR_ID(filters)
502502
STRUCT_FOR_ID(final)
503+
STRUCT_FOR_ID(finalizer)
503504
STRUCT_FOR_ID(find_class)
505+
STRUCT_FOR_ID(firstiter)
504506
STRUCT_FOR_ID(fix_imports)
505507
STRUCT_FOR_ID(flags)
506508
STRUCT_FOR_ID(flush)

‎Include/internal/pycore_intrinsics.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
#define INTRINSIC_SET_FUNCTION_TYPE_PARAMS 4
3232
#define INTRINSIC_SET_TYPEPARAM_DEFAULT 5
3333
#define INTRINSIC_ADD_CONDITIONAL_ANNOTATION 6
34+
#define INTRINSIC_MATCH_CLASS_ISINSTANCE 7
3435

35-
#define MAX_INTRINSIC_2 6
36+
#define MAX_INTRINSIC_2 7
3637

3738
typedef PyObject *(*intrinsic_func1)(PyThreadState* tstate, PyObject *value);
3839
typedef PyObject *(*intrinsic_func2)(PyThreadState* tstate, PyObject *value1, PyObject *value2);

‎Include/internal/pycore_magic_number.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ Known values:
303303
Python 3.16a1 3703 (Replace DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL)
304304
Python 3.16a1 3704 (Replace DELETE_ATTR with PUSH_NULL; STORE_ATTR)
305305
Python 3.16a1 3705 (Add INTRINSIC_ADD_CONDITIONAL_ANNOTATION)
306+
Python 3.16a1 3706 (Add INTRINSIC_MATCH_CLASS_ISINSTANCE)
306307
307308
Python 3.17 will start with 3750
308309
@@ -312,7 +313,7 @@ Known values:
312313
313314
*/
314315

315-
#define PYC_MAGIC_NUMBER 3705
316+
#define PYC_MAGIC_NUMBER 3706
316317
/* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes
317318
(little-endian) and then appending b'\r\n'. */
318319
#define PYC_MAGIC_NUMBER_TOKEN \

0 commit comments

Comments
 (0)