Skip to content

Commit f0df47c

Browse files
authored
Merge branch 'main' into pythongh-160334-collapsed-unreadable-frame
2 parents b5f7aaf + 4f64990 commit f0df47c

167 files changed

Lines changed: 1780 additions & 683 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/builtins/functions.rst‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,7 @@ are always available. They are listed here in alphabetical order.
740740
This function supports dynamic execution of Python code. *source* must be
741741
either a string or a code object. If it is a string, the string is parsed as
742742
a suite of Python statements which is then executed (unless a syntax error
743-
occurs). [#]_ If it is a code object, it is simply executed. In all cases,
743+
occurs). If it is a code object, it is simply executed. In all cases,
744744
the code that's executed is expected to be valid as file input (see the
745745
section :ref:`file-input` in the Reference Manual). Be aware that the
746746
:keyword:`nonlocal`, :keyword:`yield`, and :keyword:`return`
@@ -1950,7 +1950,7 @@ are always available. They are listed here in alphabetical order.
19501950
>>> MISSING
19511951
<MISSING>
19521952

1953-
Sentinel objects are truthy and compare equal only to themselves. They are
1953+
Sentinel objects are true and compare equal only to themselves. They are
19541954
intended to be compared with the :keyword:`is` operator.
19551955

19561956
``sentinel`` does not support subclassing.
@@ -2470,9 +2470,3 @@ are always available. They are listed here in alphabetical order.
24702470
.. versionchanged:: 3.9
24712471
When the command line options :option:`-E` or :option:`-I` are being used,
24722472
the environment variable :envvar:`PYTHONCASEOK` is now ignored.
2473-
2474-
.. rubric:: Footnotes
2475-
2476-
.. [#] Note that the parser only accepts the Unix-style end of line convention.
2477-
If you are reading the code from a file, make sure to use newline conversion
2478-
mode to convert Windows or Mac-style newlines.

‎Doc/builtins/stdtypes.rst‎

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,8 +1225,8 @@ the underlying generator function:
12251225
If the asynchronous generator function then exits gracefully, is already
12261226
closed, or raises :exc:`GeneratorExit` (by not catching the exception),
12271227
then the returned awaitable will raise a :exc:`StopIteration` exception.
1228-
Any further awaitables returned by subsequent calls to the asynchronous
1229-
generator will raise a :exc:`StopAsyncIteration` exception.
1228+
Awaitables returned by subsequent calls to :meth:`~agen.__anext__`
1229+
or :meth:`~agen.asend` will raise a :exc:`StopAsyncIteration` exception.
12301230

12311231
If the asynchronous generator yields a value, a :exc:`RuntimeError` is
12321232
raised by the awaitable.
@@ -2313,19 +2313,19 @@ expression support in the :mod:`re` module).
23132313

23142314
Perform a string formatting operation. The string on which this method is
23152315
called can contain literal text or replacement fields delimited by braces
2316-
``{}``. Each replacement field contains either the numeric index of a
2317-
positional argument, or the name of a keyword argument. Returns a copy of
2316+
``{}``. Each replacement field refers to a positional argument (numbered
2317+
explicitly or automatically) or a keyword argument. Returns a copy of
23182318
the string where each replacement field is replaced with the string value of
23192319
the corresponding argument. For example:
23202320

23212321
.. doctest::
23222322

2323-
>>> "The sum of 1 + 2 is {0}".format(1+2)
2324-
'The sum of 1 + 2 is 3'
2325-
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
2323+
>>> "The sum of {} + {} is {}".format(1, 2, 1+2)
23262324
'The sum of 1 + 2 is 3'
23272325
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
23282326
'Nobody expects the Spanish Inquisition!'
2327+
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
2328+
'The sum of 1 + 2 is 3'
23292329

23302330
See :ref:`formatstrings` for a description of the various formatting options
23312331
that can be specified in format strings.
@@ -3180,7 +3180,7 @@ expression support in the :mod:`re` module).
31803180

31813181
Return a copy of the string with all the cased characters [4]_ converted to
31823182
uppercase. Note that ``s.upper().isupper()`` might be ``False`` if ``s``
3183-
contains uncased characters or if the Unicode category of the resulting
3183+
contains no cased characters or if the Unicode category of the resulting
31843184
character(s) is not "Lu" (Letter, uppercase), but e.g. "Lt" (Letter,
31853185
titlecase).
31863186

@@ -3537,9 +3537,8 @@ The conversion types are:
35373537
| | character in the result. | |
35383538
+------------+-----------------------------------------------------+-------+
35393539

3540-
For floating-point formats, the result should be correctly rounded to a given
3541-
precision ``p`` of digits after the decimal point. The rounding mode matches
3542-
that of the :func:`round` builtin.
3540+
For floating-point formats, the result should be correctly rounded to the
3541+
specified precision. The rounding mode matches that of the :func:`round` builtin.
35433542

35443543
Notes:
35453544

@@ -5928,8 +5927,9 @@ can be used interchangeably to index the same dictionary entry.
59285927

59295928

59305929
.. seealso::
5931-
:class:`frozendict` and :class:`types.MappingProxyType` can be used to
5932-
create a read-only view of a :class:`dict`.
5930+
:class:`types.MappingProxyType` can be used to create a read-only view
5931+
of a :class:`dict`. :class:`frozendict` is an immutable version of
5932+
:class:`dict`.
59335933

59345934
.. seealso::
59355935

@@ -6082,8 +6082,7 @@ Frozen dictionaries
60826082

60836083
Similar to :meth:`dict.fromkeys`, but call again the type constructor
60846084
with an initialized :class:`frozendict` if the type is a
6085-
:class:`frozendict` subclass or if the constructor returned a
6086-
:class:`frozendict`.
6085+
:class:`frozendict` subclass.
60876086

60886087
.. versionadded:: 3.15
60896088

@@ -6532,8 +6531,8 @@ The user-exposed type for the union object can be accessed from
65326531

65336532
.. note::
65346533
The :meth:`!__or__` method for type objects was added to support the syntax
6535-
``X | Y``. If a metaclass implements :meth:`!__or__`, the Union may
6536-
override it:
6534+
``X | Y``. If a metaclass implements :meth:`!__or__`, it may override
6535+
the default behavior of creating a union:
65376536

65386537
.. doctest::
65396538

‎Doc/c-api/module.rst‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,19 +552,19 @@ This means that if you have a module object, but you are not sure if it
552552
553553
.. code-block:: c
554554
555-
PyObject *module = <the module in question>
555+
PyObject *module = <the module in question>;
556556
557557
void *module_token;
558558
if (PyModule_GetToken(module, &module_token) < 0) {
559559
return NULL;
560560
}
561561
if (module_token != your_token) {
562-
PyErr_SetString(PyExc_ValueError, "unexpected module")
562+
PyErr_SetString(PyExc_ValueError, "unexpected module");
563563
return NULL;
564564
}
565565
566566
// This module's state has the expected memory layout; it's safe to cast
567-
struct my_state state = (struct my_state*)PyModule_GetState(module)
567+
struct my_state *state = (struct my_state*)PyModule_GetState(module);
568568
569569
A module's token -- and the *your_token* value to use in the above code -- is:
570570

‎Doc/c-api/typeobj.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3343,7 +3343,7 @@ A type that supports weakrefs, instance dicts, and hashing::
33433343
.tp_new = myobj_new,
33443344
.tp_traverse = (traverseproc)myobj_traverse,
33453345
.tp_clear = (inquiry)myobj_clear,
3346-
.tp_alloc = PyType_GenericNew,
3346+
.tp_alloc = PyType_GenericAlloc,
33473347
.tp_dealloc = (destructor)myobj_dealloc,
33483348
.tp_repr = (reprfunc)myobj_repr,
33493349
.tp_hash = (hashfunc)myobj_hash,

‎Doc/extending/embedding.rst‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,16 @@ perform some operation on a file. ::
9595
See :ref:`arg-parsing-string-and-buffers` for a description of this macro.
9696

9797
Setting :c:member:`PyConfig.program_name` should be called before
98-
:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to Python run-time
99-
libraries. Next, the Python interpreter is initialized with
100-
:c:func:`Py_Initialize`, followed by the execution of a hard-coded Python script
101-
that prints the date and time. Afterwards, the :c:func:`Py_FinalizeEx` call shuts
102-
the interpreter down, followed by the end of the program. In a real program,
103-
you may want to get the Python script from another source, perhaps a text-editor
104-
routine, a file, or a database. Getting the Python code from a file can better
105-
be done by using the :c:func:`PyRun_SimpleFile` function, which saves you the
106-
trouble of allocating memory space and loading the file contents.
98+
:c:func:`Py_InitializeFromConfig` to inform the interpreter about paths to
99+
Python run-time libraries. Next, the Python interpreter is initialized with
100+
:c:func:`Py_InitializeFromConfig`, followed by the execution of a hard-coded
101+
Python script that prints the date and time. Afterwards, the
102+
:c:func:`Py_FinalizeEx` call shuts the interpreter down, followed by the end of
103+
the program. In a real program, you may want to get the Python script from
104+
another source, perhaps a text-editor routine, a file, or a database. Getting
105+
the Python code from a file can better be done by using the
106+
:c:func:`PyRun_SimpleFile` function, which saves you the trouble of allocating
107+
memory space and loading the file contents.
107108

108109

109110
.. _lower-level-embedding:

‎Doc/extending/extending.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ exporting module, not a client module. Finally, the module's :c:data:`mod_exec
10401040
}
10411041

10421042
Note that ``PySpam_API`` is declared ``static``; otherwise the pointer
1043-
array would disappear when :c:func:`!PyInit_spam` terminates!
1043+
array would disappear when :c:func:`!spam_module_exec` terminates!
10441044

10451045
The bulk of the work is in the header file :file:`spammodule.h`, which looks
10461046
like this::

‎Doc/faq/design.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Design and History FAQ
55
.. only:: html
66

77
.. contents::
8+
:local:
89

910

1011
Why does Python use indentation for grouping of statements?

‎Doc/faq/extending.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Extending/Embedding FAQ
55
.. only:: html
66

77
.. contents::
8+
:local:
89

910
.. highlight:: c
1011

‎Doc/faq/general.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ General Python FAQ
77
.. only:: html
88

99
.. contents::
10+
:local:
1011

1112

1213
General Information

‎Doc/faq/gui.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Graphic User Interface FAQ
77
.. only:: html
88

99
.. contents::
10+
:local:
1011

1112
.. XXX need review for Python 3.
1213

0 commit comments

Comments
 (0)