Skip to content

Commit 93933f7

Browse files
authored
Merge pull request #513 from python/main
Sync Fork from Upstream Repo
2 parents cb6468d + 7b21108 commit 93933f7

65 files changed

Lines changed: 8059 additions & 7559 deletions

Some content is hidden

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

Doc/c-api/function.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,16 @@ There are a few functions specific to Python functions.
3636
3737
The function's docstring and name are retrieved from the code object. *__module__*
3838
is retrieved from *globals*. The argument defaults, annotations and closure are
39-
set to ``NULL``. *__qualname__* is set to the same value as the function's name.
39+
set to ``NULL``. *__qualname__* is set to the same value as the code object's
40+
``co_qualname`` field.
4041
4142
4243
.. c:function:: PyObject* PyFunction_NewWithQualName(PyObject *code, PyObject *globals, PyObject *qualname)
4344
4445
As :c:func:`PyFunction_New`, but also allows setting the function object's
4546
``__qualname__`` attribute. *qualname* should be a unicode object or ``NULL``;
46-
if ``NULL``, the ``__qualname__`` attribute is set to the same value as its
47-
``__name__`` attribute.
47+
if ``NULL``, the ``__qualname__`` attribute is set to the same value as the
48+
code object's ``co_qualname`` field.
4849
4950
.. versionadded:: 3.3
5051

Doc/c-api/init_config.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,16 @@ PyConfig
596596
597597
.. versionadded:: 3.10
598598
599+
.. c:member:: int no_debug_ranges
600+
601+
If equals to ``1``, disables the inclusion of the end line and column
602+
mappings in code objects. Also disables traceback printing carets to
603+
specific error locations.
604+
605+
Default: ``0``.
606+
607+
.. versionadded:: 3.11
608+
599609
.. c:member:: wchar_t* check_hash_pycs_mode
600610
601611
Control the validation behavior of hash-based ``.pyc`` files:

Doc/c-api/typeobj.rst

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ and :c:type:`PyType_Type` effectively act as defaults.)
710710

711711
.. warning::
712712

713-
It is not recommended for :ref:`heap types <heap-types>` to implement
713+
It is not recommended for :ref:`mutable heap types <heap-types>` to implement
714714
the vectorcall protocol.
715715
When a user sets :attr:`__call__` in Python code, only *tp_call* is updated,
716716
likely making it inconsistent with the vectorcall function.
@@ -734,8 +734,9 @@ and :c:type:`PyType_Type` effectively act as defaults.)
734734
always inherited. If it's not, then the subclass won't use
735735
:ref:`vectorcall <vectorcall>`, except when
736736
:c:func:`PyVectorcall_Call` is explicitly called.
737-
This is in particular the case for :ref:`heap types <heap-types>`
738-
(including subclasses defined in Python).
737+
This is in particular the case for types without the
738+
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set (including subclasses defined in
739+
Python).
739740

740741

741742
.. c:member:: getattrfunc PyTypeObject.tp_getattr
@@ -1125,9 +1126,9 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11251126

11261127
**Inheritance:**
11271128

1128-
This flag is never inherited by :ref:`heap types <heap-types>`.
1129-
For extension types, it is inherited whenever
1130-
:c:member:`~PyTypeObject.tp_descr_get` is inherited.
1129+
This flag is never inherited by types without the
1130+
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is
1131+
inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited.
11311132

11321133

11331134
.. XXX Document more flags here?
@@ -1172,9 +1173,9 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11721173

11731174
**Inheritance:**
11741175

1175-
This bit is inherited for :ref:`static subtypes <static-types>` if
1176+
This bit is inherited for types with the
1177+
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set, if
11761178
:c:member:`~PyTypeObject.tp_call` is also inherited.
1177-
:ref:`Heap types <heap-types>` do not inherit ``Py_TPFLAGS_HAVE_VECTORCALL``.
11781179

11791180
.. versionadded:: 3.9
11801181

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ Scheduling From Other Threads
763763

764764
try:
765765
result = future.result(timeout)
766-
except asyncio.TimeoutError:
766+
except concurrent.futures.TimeoutError:
767767
print('The coroutine took too long, cancelling the task...')
768768
future.cancel()
769769
except Exception as exc:

Doc/library/inspect.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ attributes:
187187
| | co_name | name with which this code |
188188
| | | object was defined |
189189
+-----------+-------------------+---------------------------+
190+
| | co_qualname | fully-qualified name with |
191+
| | | which this code object |
192+
| | | was defined |
193+
+-----------+-------------------+---------------------------+
190194
| | co_names | tuple of names of local |
191195
| | | variables |
192196
+-----------+-------------------+---------------------------+

Doc/library/multiprocessing.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,8 +2242,9 @@ with the :class:`Pool` class.
22422242

22432243
.. method:: starmap(func, iterable[, chunksize])
22442244

2245-
Like :meth:`map` except that the elements of the *iterable* are expected
2246-
to be iterables that are unpacked as arguments.
2245+
Like :meth:`~multiprocessing.pool.Pool.map` except that the
2246+
elements of the *iterable* are expected to be iterables that are
2247+
unpacked as arguments.
22472248

22482249
Hence an *iterable* of ``[(1,2), (3, 4)]`` results in ``[func(1,2),
22492250
func(3,4)]``.

Doc/library/pdb.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,14 @@ middle of a quoted string.
241241
triple: debugger; configuration; file
242242

243243
If a file :file:`.pdbrc` exists in the user's home directory or in the current
244-
directory, it is read in and executed as if it had been typed at the debugger
245-
prompt. This is particularly useful for aliases. If both files exist, the one
246-
in the home directory is read first and aliases defined there can be overridden
247-
by the local file.
244+
directory, it is read with ``'utf-8'`` encoding and executed as if it had been
245+
typed at the debugger prompt. This is particularly useful for aliases. If both
246+
files exist, the one in the home directory is read first and aliases defined there
247+
can be overridden by the local file.
248+
249+
.. versionchanged:: 3.11
250+
:file:`.pdbrc` is now read with ``'utf-8'`` encoding. Previously, it was read
251+
with the system locale encoding.
248252

249253
.. versionchanged:: 3.2
250254
:file:`.pdbrc` can now contain commands that continue debugging, such as

Doc/reference/datamodel.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,8 +969,10 @@ Internal types
969969
single: co_varnames (code object attribute)
970970
single: co_cellvars (code object attribute)
971971
single: co_freevars (code object attribute)
972+
single: co_qualname (code object attribute)
972973

973974
Special read-only attributes: :attr:`co_name` gives the function name;
975+
:attr:`co_qualname` gives the fully qualified function name;
974976
:attr:`co_argcount` is the total number of positional arguments
975977
(including positional-only arguments and arguments with default values);
976978
:attr:`co_posonlyargcount` is the number of positional-only arguments

Doc/tools/templates/indexcontent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% block body %}
66
<h1>{{ docstitle|e }}</h1>
77
<p>
8-
{% trans %}Welcome! This is the documentation for Python {{ release }}.{% endtrans %}
8+
{% trans %}Welcome! This is the official documentation for Python {{ release }}.{% endtrans %}
99
</p>
1010
<p><strong>{% trans %}Parts of the documentation:{% endtrans %}</strong></p>
1111
<table class="contentstable" align="center"><tr>

Doc/using/cmdline.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,12 @@ Miscellaneous options
474474
* ``-X warn_default_encoding`` issues a :class:`EncodingWarning` when the
475475
locale-specific default encoding is used for opening files.
476476
See also :envvar:`PYTHONWARNDEFAULTENCODING`.
477+
* ``-X no_debug_ranges`` disables the inclusion of the tables mapping extra
478+
location information (end line, start column offset and end column offset)
479+
to every instruction in code objects. This is useful when smaller code
480+
objects and pyc files are desired as well as supressing the extra visual
481+
location indicators when the interpreter displays tracebacks. See also
482+
:envvar:`PYTHONNODEBUGRANGES`.
477483

478484
It also allows passing arbitrary values and retrieving them through the
479485
:data:`sys._xoptions` dictionary.
@@ -509,6 +515,9 @@ Miscellaneous options
509515
.. deprecated-removed:: 3.9 3.10
510516
The ``-X oldparser`` option.
511517

518+
.. versionadded:: 3.11
519+
The ``-X no_debug_ranges`` option.
520+
512521

513522
Options you shouldn't use
514523
~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -936,6 +945,17 @@ conflict.
936945

937946
.. versionadded:: 3.10
938947

948+
.. envvar:: PYTHONNODEBUGRANGES
949+
950+
If this variable is set, it disables the inclusion of the tables mapping
951+
extra location information (end line, start column offset and end column
952+
offset) to every instruction in code objects. This is useful when smaller
953+
code objects and pyc files are desired as well as supressing the extra visual
954+
location indicators when the interpreter displays tracebacks.
955+
956+
.. versionadded:: 3.11
957+
958+
939959

940960
Debug-mode variables
941961
~~~~~~~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)