Skip to content

Commit 8a8aa09

Browse files
authored
Merge branch 'main' into remove-asyncio-from-contextlib-async-tests
2 parents c32e7c7 + 9b30b96 commit 8a8aa09

File tree

236 files changed

+15075
-1648
lines changed

Some content is hidden

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

236 files changed

+15075
-1648
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Objects/codeobject.c @markshannon
1818
Objects/frameobject.c @markshannon
1919
Objects/call.c @markshannon
2020
Python/ceval.c @markshannon
21-
Python/compile.c @markshannon
21+
Python/compile.c @markshannon @iritkatriel
2222
Python/ast_opt.c @isidentical
2323
Lib/test/test_patma.py @brandtbucher
2424
Lib/test/test_peepholer.py @brandtbucher
@@ -29,7 +29,6 @@ Lib/test/test_except*.py @iritkatriel
2929
Lib/test/test_traceback.py @iritkatriel
3030
Objects/exceptions.c @iritkatriel
3131
Python/traceback.c @iritkatriel
32-
Python/pythonrun.c @iritkatriel
3332

3433
# Hashing
3534
**/*hashlib* @tiran

Doc/c-api/object.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ Object Protocol
126126
A generic implementation for the getter of a ``__dict__`` descriptor. It
127127
creates the dictionary if necessary.
128128
129+
This function may also be called to get the :py:attr:`~object.__dict__`
130+
of the object *o*. Pass ``NULL`` for *context* when calling it.
131+
Since this function may need to allocate memory for the
132+
dictionary, it may be more efficient to call :c:func:`PyObject_GetAttr`
133+
when accessing an attribute on the object.
134+
135+
On failure, returns ``NULL`` with an exception set.
136+
129137
.. versionadded:: 3.3
130138
131139
@@ -137,6 +145,16 @@ Object Protocol
137145
.. versionadded:: 3.3
138146
139147
148+
.. c:function:: PyObject** _PyObject_GetDictPtr(PyObject *obj)
149+
150+
Return a pointer to :py:attr:`~object.__dict__` of the object *obj*.
151+
If there is no ``__dict__``, return ``NULL`` without setting an exception.
152+
153+
This function may need to allocate memory for the
154+
dictionary, so it may be more efficient to call :c:func:`PyObject_GetAttr`
155+
when accessing an attribute on the object.
156+
157+
140158
.. c:function:: PyObject* PyObject_RichCompare(PyObject *o1, PyObject *o2, int opid)
141159
142160
Compare the values of *o1* and *o2* using the operation specified by *opid*,

Doc/c-api/typeobj.rst

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,18 +1715,11 @@ and :c:type:`PyType_Type` effectively act as defaults.)
17151715
:c:member:`~PyTypeObject.tp_dictoffset` should be set to ``-4`` to indicate that the dictionary is
17161716
at the very end of the structure.
17171717

1718-
The real dictionary offset in an instance can be computed from a negative
1719-
:c:member:`~PyTypeObject.tp_dictoffset` as follows::
1720-
1721-
dictoffset = tp_basicsize + abs(ob_size)*tp_itemsize + tp_dictoffset
1722-
if dictoffset is not aligned on sizeof(void*):
1723-
round up to sizeof(void*)
1724-
1725-
where :c:member:`~PyTypeObject.tp_basicsize`, :c:member:`~PyTypeObject.tp_itemsize` and :c:member:`~PyTypeObject.tp_dictoffset` are
1726-
taken from the type object, and :attr:`ob_size` is taken from the instance. The
1727-
absolute value is taken because ints use the sign of :attr:`ob_size` to
1728-
store the sign of the number. (There's never a need to do this calculation
1729-
yourself; it is done for you by :c:func:`_PyObject_GetDictPtr`.)
1718+
The :c:member:`~PyTypeObject.tp_dictoffset` should be regarded as write-only.
1719+
To get the pointer to the dictionary call :c:func:`PyObject_GenericGetDict`.
1720+
Calling :c:func:`PyObject_GenericGetDict` may need to allocate memory for the
1721+
dictionary, so it is may be more efficient to call :c:func:`PyObject_GetAttr`
1722+
when accessing an attribute on the object.
17301723

17311724
**Inheritance:**
17321725

Doc/c-api/unicode.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,9 +477,6 @@ APIs:
477477
| | | :c:func:`PyObject_Repr`. |
478478
+-------------------+---------------------+----------------------------------+
479479
480-
An unrecognized format character causes all the rest of the format string to be
481-
copied as-is to the result string, and any extra arguments discarded.
482-
483480
.. note::
484481
The width formatter unit is number of characters rather than bytes.
485482
The precision formatter unit is number of bytes for ``"%s"`` and
@@ -500,6 +497,11 @@ APIs:
500497
Support width and precision formatter for ``"%s"``, ``"%A"``, ``"%U"``,
501498
``"%V"``, ``"%S"``, ``"%R"`` added.
502499
500+
.. versionchanged:: 3.12
501+
An unrecognized format character now sets a :exc:`SystemError`.
502+
In previous versions it caused all the rest of the format string to be
503+
copied as-is to the result string, and any extra arguments discarded.
504+
503505
504506
.. c:function:: PyObject* PyUnicode_FromFormatV(const char *format, va_list vargs)
505507

Doc/glossary.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,9 @@ Glossary
566566
from their :func:`id`.
567567

568568
IDLE
569-
An Integrated Development Environment for Python. IDLE is a basic editor
570-
and interpreter environment which ships with the standard distribution of
571-
Python.
569+
An Integrated Development and Learning Environment for Python.
570+
:ref:`idle` is a basic editor and interpreter environment
571+
which ships with the standard distribution of Python.
572572

573573
immutable
574574
An object with a fixed value. Immutable objects include numbers, strings and

Doc/howto/functional.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,8 @@ describing functional programming.
12231223

12241224
https://en.wikipedia.org/wiki/Coroutine: Entry for coroutines.
12251225

1226+
https://en.wikipedia.org/wiki/Partial_application: Entry for the concept of partial function application.
1227+
12261228
https://en.wikipedia.org/wiki/Currying: Entry for the concept of currying.
12271229

12281230
Python-specific

Doc/includes/sqlite3/complete_statement.py

Lines changed: 0 additions & 33 deletions
This file was deleted.

Doc/library/asyncio-eventloop.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ Creating Futures and Tasks
332332

333333
.. method:: loop.create_task(coro, *, name=None, context=None)
334334

335-
Schedule the execution of a :ref:`coroutine`.
335+
Schedule the execution of :ref:`coroutine <coroutine>` *coro*.
336336
Return a :class:`Task` object.
337337

338338
Third-party event loops can use their own subclass of :class:`Task`

Doc/library/asyncio-runner.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ Runner context manager
7575
:ref:`asyncio-debug-mode` settings.
7676

7777
*loop_factory* could be used for overriding the loop creation.
78-
:func:`asyncio.new_event_loop` is used if ``None``.
78+
It is the responsibility of the *loop_factory* to set the created loop as the
79+
current one. By default :func:`asyncio.new_event_loop` is used and set as
80+
current event loop with :func:`asyncio.set_event_loop` if *loop_factory* is ``None``.
7981

8082
Basically, :func:`asyncio.run()` example can be rewritten with the runner usage::
8183

Doc/library/bisect.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,16 @@
1313

1414
This module provides support for maintaining a list in sorted order without
1515
having to sort the list after each insertion. For long lists of items with
16-
expensive comparison operations, this can be an improvement over the more common
17-
approach. The module is called :mod:`bisect` because it uses a basic bisection
18-
algorithm to do its work. The source code may be most useful as a working
19-
example of the algorithm (the boundary conditions are already right!).
16+
expensive comparison operations, this can be an improvement over
17+
linear searches or frequent resorting.
18+
19+
The module is called :mod:`bisect` because it uses a basic bisection
20+
algorithm to do its work. Unlike other bisection tools that search for a
21+
specific value, the functions in this module are designed to locate an
22+
insertion point. Accordingly, the functions never call an :meth:`__eq__`
23+
method to determine whether a value has been found. Instead, the
24+
functions only call the :meth:`__lt__` method and will return an insertion
25+
point between values in an array.
2026

2127
The following functions are provided:
2228

@@ -30,16 +36,17 @@ The following functions are provided:
3036
any existing entries. The return value is suitable for use as the first
3137
parameter to ``list.insert()`` assuming that *a* is already sorted.
3238

33-
The returned insertion point *i* partitions the array *a* into two halves so
34-
that ``all(val < x for val in a[lo : i])`` for the left side and
35-
``all(val >= x for val in a[i : hi])`` for the right side.
39+
The returned insertion point *ip* partitions the array *a* into two
40+
slices such that ``all(elem < x for elem in a[lo : ip])`` is true for the
41+
left slice and ``all(elem >= x for elem in a[ip : hi])`` is true for the
42+
right slice.
3643

3744
*key* specifies a :term:`key function` of one argument that is used to
3845
extract a comparison key from each element in the array. To support
3946
searching complex records, the key function is not applied to the *x* value.
4047

41-
If *key* is ``None``, the elements are compared directly with no
42-
intervening function call.
48+
If *key* is ``None``, the elements are compared directly and
49+
no key function is called.
4350

4451
.. versionchanged:: 3.10
4552
Added the *key* parameter.
@@ -51,16 +58,9 @@ The following functions are provided:
5158
Similar to :func:`bisect_left`, but returns an insertion point which comes
5259
after (to the right of) any existing entries of *x* in *a*.
5360

54-
The returned insertion point *i* partitions the array *a* into two halves so
55-
that ``all(val <= x for val in a[lo : i])`` for the left side and
56-
``all(val > x for val in a[i : hi])`` for the right side.
57-
58-
*key* specifies a :term:`key function` of one argument that is used to
59-
extract a comparison key from each element in the array. To support
60-
searching complex records, the key function is not applied to the *x* value.
61-
62-
If *key* is ``None``, the elements are compared directly with no
63-
intervening function call.
61+
The returned insertion point *ip* partitions the array *a* into two slices
62+
such that ``all(elem <= x for elem in a[lo : ip])`` is true for the left slice and
63+
``all(elem > x for elem in a[ip : hi])`` is true for the right slice.
6464

6565
.. versionchanged:: 3.10
6666
Added the *key* parameter.

Doc/library/errno.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,12 @@ defined by the module. The specific list of defined symbols is available as
657657
Interface output queue is full
658658

659659
.. versionadded:: 3.11
660+
661+
.. data:: ENOTCAPABLE
662+
663+
Capabilities insufficient. This error is mapped to the exception
664+
:exc:`PermissionError`.
665+
666+
.. availability:: WASI
667+
668+
.. versionadded:: 3.11.1

Doc/library/exceptions.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,12 @@ depending on the system error code.
746746

747747
Raised when trying to run an operation without the adequate access
748748
rights - for example filesystem permissions.
749-
Corresponds to :c:data:`errno` :py:data:`~errno.EACCES` and :py:data:`~errno.EPERM`.
749+
Corresponds to :c:data:`errno` :py:data:`~errno.EACCES`,
750+
:py:data:`~errno.EPERM`, and :py:data:`~errno.ENOTCAPABLE`.
751+
752+
.. versionchanged:: 3.11.1
753+
WASI's :py:data:`~errno.ENOTCAPABLE` is now mapped to
754+
:exc:`PermissionError`.
750755

751756
.. exception:: ProcessLookupError
752757

Doc/library/grp.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ It defines the following items:
4545
Return the group database entry for the given numeric group ID. :exc:`KeyError`
4646
is raised if the entry asked for cannot be found.
4747

48-
.. deprecated:: 3.6
49-
Since Python 3.6 the support of non-integer arguments like floats or
50-
strings in :func:`getgrgid` is deprecated.
48+
.. versionchanged:: 3.10
49+
:exc:`TypeError` is raised for non-integer arguments like floats or strings.
5150

5251
.. function:: getgrnam(name)
5352

Doc/library/idle.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,3 +983,23 @@ changed with the Extensions tab of the preferences dialog. See the
983983
beginning of config-extensions.def in the idlelib directory for further
984984
information. The only current default extension is zzdummy, an example
985985
also used for testing.
986+
987+
988+
idlelib
989+
-------
990+
991+
.. module:: idlelib
992+
:synopsis: Implementation package for the IDLE shell/editor.
993+
994+
**Source code:** :source:`Lib/idlelib`
995+
996+
--------------
997+
998+
The Lib/idlelib package implements the IDLE application. See the rest
999+
of this page for how to use IDLE.
1000+
1001+
The files in idlelib are described in idlelib/README.txt. Access it
1002+
either in idlelib or click Help => About IDLE on the IDLE menu. This
1003+
file also maps IDLE menu items to the code that implements the item.
1004+
Except for files listed under 'Startup', the idlelib code is 'private' in
1005+
sense that feature changes can be backported (see :pep:`434`).

0 commit comments

Comments
 (0)