Skip to content

Commit 55d7090

Browse files
Merge branch 'main' into subinterpreters-allow-background-threads
2 parents 1f2a321 + 3439cb0 commit 55d7090

File tree

114 files changed

+2162
-1747
lines changed

Some content is hidden

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

114 files changed

+2162
-1747
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,6 @@ jobs:
140140
run: make regen-configure
141141
- name: Build CPython
142142
run: |
143-
# Deepfreeze will usually cause global objects to be added or removed,
144-
# so we run it before regen-global-objects gets rum (in regen-all).
145-
make regen-deepfreeze
146143
make -j4 regen-all
147144
make regen-stdlib-module-names
148145
- name: Check for changes
@@ -261,7 +258,7 @@ jobs:
261258
needs: check_source
262259
if: needs.check_source.outputs.run_tests == 'true'
263260
env:
264-
OPENSSL_VER: 1.1.1v
261+
OPENSSL_VER: 3.0.11
265262
PYTHONSTRICTEXTENSIONBUILD: 1
266263
steps:
267264
- uses: actions/checkout@v4
@@ -330,7 +327,7 @@ jobs:
330327
strategy:
331328
fail-fast: false
332329
matrix:
333-
openssl_ver: [1.1.1v, 3.0.10, 3.1.2]
330+
openssl_ver: [1.1.1w, 3.0.11, 3.1.3]
334331
env:
335332
OPENSSL_VER: ${{ matrix.openssl_ver }}
336333
MULTISSL_DIR: ${{ github.workspace }}/multissl
@@ -382,7 +379,7 @@ jobs:
382379
needs: check_source
383380
if: needs.check_source.outputs.run_tests == 'true' && needs.check_source.outputs.run_hypothesis == 'true'
384381
env:
385-
OPENSSL_VER: 1.1.1v
382+
OPENSSL_VER: 3.0.11
386383
PYTHONSTRICTEXTENSIONBUILD: 1
387384
steps:
388385
- uses: actions/checkout@v4
@@ -491,7 +488,7 @@ jobs:
491488
needs: check_source
492489
if: needs.check_source.outputs.run_tests == 'true'
493490
env:
494-
OPENSSL_VER: 1.1.1v
491+
OPENSSL_VER: 3.0.11
495492
PYTHONSTRICTEXTENSIONBUILD: 1
496493
ASAN_OPTIONS: detect_leaks=0:allocator_may_return_null=1:handle_segv=0
497494
steps:

Doc/howto/urllib2.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,11 +194,11 @@ which comes after we have a look at what happens when things go wrong.
194194
Handling Exceptions
195195
===================
196196

197-
*urlopen* raises :exc:`URLError` when it cannot handle a response (though as
197+
*urlopen* raises :exc:`~urllib.error.URLError` when it cannot handle a response (though as
198198
usual with Python APIs, built-in exceptions such as :exc:`ValueError`,
199199
:exc:`TypeError` etc. may also be raised).
200200

201-
:exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific case of
201+
:exc:`~urllib.error.HTTPError` is the subclass of :exc:`~urllib.error.URLError` raised in the specific case of
202202
HTTP URLs.
203203

204204
The exception classes are exported from the :mod:`urllib.error` module.
@@ -229,12 +229,12 @@ the status code indicates that the server is unable to fulfil the request. The
229229
default handlers will handle some of these responses for you (for example, if
230230
the response is a "redirection" that requests the client fetch the document from
231231
a different URL, urllib will handle that for you). For those it can't handle,
232-
urlopen will raise an :exc:`HTTPError`. Typical errors include '404' (page not
232+
urlopen will raise an :exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not
233233
found), '403' (request forbidden), and '401' (authentication required).
234234

235235
See section 10 of :rfc:`2616` for a reference on all the HTTP error codes.
236236

237-
The :exc:`HTTPError` instance raised will have an integer 'code' attribute, which
237+
The :exc:`~urllib.error.HTTPError` instance raised will have an integer 'code' attribute, which
238238
corresponds to the error sent by the server.
239239

240240
Error Codes
@@ -317,7 +317,7 @@ dictionary is reproduced here for convenience ::
317317
}
318318

319319
When an error is raised the server responds by returning an HTTP error code
320-
*and* an error page. You can use the :exc:`HTTPError` instance as a response on the
320+
*and* an error page. You can use the :exc:`~urllib.error.HTTPError` instance as a response on the
321321
page returned. This means that as well as the code attribute, it also has read,
322322
geturl, and info, methods as returned by the ``urllib.response`` module::
323323

@@ -338,7 +338,7 @@ geturl, and info, methods as returned by the ``urllib.response`` module::
338338
Wrapping it Up
339339
--------------
340340

341-
So if you want to be prepared for :exc:`HTTPError` *or* :exc:`URLError` there are two
341+
So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* :exc:`~urllib.error.URLError` there are two
342342
basic approaches. I prefer the second approach.
343343

344344
Number 1
@@ -365,7 +365,7 @@ Number 1
365365
.. note::
366366

367367
The ``except HTTPError`` *must* come first, otherwise ``except URLError``
368-
will *also* catch an :exc:`HTTPError`.
368+
will *also* catch an :exc:`~urllib.error.HTTPError`.
369369

370370
Number 2
371371
~~~~~~~~
@@ -391,7 +391,7 @@ Number 2
391391
info and geturl
392392
===============
393393

394-
The response returned by urlopen (or the :exc:`HTTPError` instance) has two
394+
The response returned by urlopen (or the :exc:`~urllib.error.HTTPError` instance) has two
395395
useful methods :meth:`info` and :meth:`geturl` and is defined in the module
396396
:mod:`urllib.response`..
397397

Doc/library/asyncio-stream.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ and work with streams:
157157
.. versionchanged:: 3.10
158158
Removed the *loop* parameter.
159159

160-
.. versionchanged:: 3.11
161-
Added the *ssl_shutdown_timeout* parameter.
160+
.. versionchanged:: 3.11
161+
Added the *ssl_shutdown_timeout* parameter.
162162

163163

164164
.. coroutinefunction:: start_unix_server(client_connected_cb, path=None, \

Doc/library/codecs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1350,7 +1350,7 @@ encodings.
13501350
+--------------------+---------+---------------------------+
13511351
| raw_unicode_escape | | Latin-1 encoding with |
13521352
| | | :samp:`\\u{XXXX}` and |
1353-
| | | :samp:`\\U{XXXXXXXX}`` |
1353+
| | | :samp:`\\U{XXXXXXXX}` |
13541354
| | | for other code points. |
13551355
| | | Existing |
13561356
| | | backslashes are not |

Doc/library/collections.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ Common patterns for working with :class:`Counter` objects::
358358
list(c) # list unique elements
359359
set(c) # convert to a set
360360
dict(c) # convert to a regular dictionary
361-
c.items() # convert to a list of (elem, cnt) pairs
361+
c.items() # access the (elem, cnt) pairs
362362
Counter(dict(list_of_pairs)) # convert from a list of (elem, cnt) pairs
363363
c.most_common()[:-n-1:-1] # n least common elements
364364
+c # remove zero and negative counts

Doc/library/copy.rst

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -87,28 +87,40 @@ pickle functions from the :mod:`copyreg` module.
8787
single: __copy__() (copy protocol)
8888
single: __deepcopy__() (copy protocol)
8989

90+
.. currentmodule:: None
91+
9092
In order for a class to define its own copy implementation, it can define
91-
special methods :meth:`__copy__` and :meth:`__deepcopy__`. The former is called
92-
to implement the shallow copy operation; no additional arguments are passed.
93-
The latter is called to implement the deep copy operation; it is passed one
94-
argument, the ``memo`` dictionary. If the :meth:`__deepcopy__` implementation needs
95-
to make a deep copy of a component, it should call the :func:`deepcopy` function
96-
with the component as first argument and the memo dictionary as second argument.
97-
The memo dictionary should be treated as an opaque object.
93+
special methods :meth:`~object.__copy__` and :meth:`~object.__deepcopy__`.
94+
95+
.. method:: object.__copy__(self)
96+
:noindexentry:
97+
98+
Called to implement the shallow copy operation;
99+
no additional arguments are passed.
100+
101+
.. method:: object.__deepcopy__(self, memo)
102+
:noindexentry:
103+
104+
Called to implement the deep copy operation; it is passed one
105+
argument, the *memo* dictionary. If the ``__deepcopy__`` implementation needs
106+
to make a deep copy of a component, it should call the :func:`~copy.deepcopy` function
107+
with the component as first argument and the *memo* dictionary as second argument.
108+
The *memo* dictionary should be treated as an opaque object.
98109

99110

100111
.. index::
101112
single: __replace__() (replace protocol)
102113

103-
Function :func:`replace` is more limited than :func:`copy` and :func:`deepcopy`,
114+
Function :func:`!copy.replace` is more limited
115+
than :func:`~copy.copy` and :func:`~copy.deepcopy`,
104116
and only supports named tuples created by :func:`~collections.namedtuple`,
105-
:mod:`dataclasses`, and other classes which define method :meth:`!__replace__`.
117+
:mod:`dataclasses`, and other classes which define method :meth:`~object.__replace__`.
106118

107-
.. method:: __replace__(self, /, **changes)
108-
:noindex:
119+
.. method:: object.__replace__(self, /, **changes)
120+
:noindexentry:
109121

110-
:meth:`!__replace__` should create a new object of the same type,
111-
replacing fields with values from *changes*.
122+
This method should create a new object of the same type,
123+
replacing fields with values from *changes*.
112124

113125

114126
.. seealso::

Doc/library/difflib.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,8 @@ The :class:`SequenceMatcher` class has this constructor:
570570

571571
The three methods that return the ratio of matching to total characters can give
572572
different results due to differing levels of approximation, although
573-
:meth:`quick_ratio` and :meth:`real_quick_ratio` are always at least as large as
574-
:meth:`ratio`:
573+
:meth:`~SequenceMatcher.quick_ratio` and :meth:`~SequenceMatcher.real_quick_ratio`
574+
are always at least as large as :meth:`~SequenceMatcher.ratio`:
575575

576576
>>> s = SequenceMatcher(None, "abcd", "bcde")
577577
>>> s.ratio()
@@ -593,28 +593,28 @@ This example compares two strings, considering blanks to be "junk":
593593
... "private Thread currentThread;",
594594
... "private volatile Thread currentThread;")
595595

596-
:meth:`ratio` returns a float in [0, 1], measuring the similarity of the
597-
sequences. As a rule of thumb, a :meth:`ratio` value over 0.6 means the
596+
:meth:`~SequenceMatcher.ratio` returns a float in [0, 1], measuring the similarity of the
597+
sequences. As a rule of thumb, a :meth:`~SequenceMatcher.ratio` value over 0.6 means the
598598
sequences are close matches:
599599

600600
>>> print(round(s.ratio(), 3))
601601
0.866
602602

603603
If you're only interested in where the sequences match,
604-
:meth:`get_matching_blocks` is handy:
604+
:meth:`~SequenceMatcher.get_matching_blocks` is handy:
605605

606606
>>> for block in s.get_matching_blocks():
607607
... print("a[%d] and b[%d] match for %d elements" % block)
608608
a[0] and b[0] match for 8 elements
609609
a[8] and b[17] match for 21 elements
610610
a[29] and b[38] match for 0 elements
611611

612-
Note that the last tuple returned by :meth:`get_matching_blocks` is always a
613-
dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last
612+
Note that the last tuple returned by :meth:`~SequenceMatcher.get_matching_blocks`
613+
is always a dummy, ``(len(a), len(b), 0)``, and this is the only case in which the last
614614
tuple element (number of elements matched) is ``0``.
615615

616616
If you want to know how to change the first sequence into the second, use
617-
:meth:`get_opcodes`:
617+
:meth:`~SequenceMatcher.get_opcodes`:
618618

619619
>>> for opcode in s.get_opcodes():
620620
... print("%6s a[%d:%d] b[%d:%d]" % opcode)
@@ -689,7 +689,7 @@ Differ Example
689689

690690
This example compares two texts. First we set up the texts, sequences of
691691
individual single-line strings ending with newlines (such sequences can also be
692-
obtained from the :meth:`~io.BaseIO.readlines` method of file-like objects):
692+
obtained from the :meth:`~io.IOBase.readlines` method of file-like objects):
693693

694694
>>> text1 = ''' 1. Beautiful is better than ugly.
695695
... 2. Explicit is better than implicit.

Doc/library/symtable.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ Examining Symbol Tables
3838
.. method:: get_type()
3939

4040
Return the type of the symbol table. Possible values are ``'class'``,
41-
``'module'``, and ``'function'``.
41+
``'module'``, ``'function'``, ``'annotation'``, ``'TypeVar bound'``,
42+
``'type alias'``, and ``'type parameter'``. The latter four refer to
43+
different flavors of :ref:`annotation scopes <annotation-scopes>`.
44+
45+
.. versionchanged:: 3.12
46+
Added ``'annotation'``, ``'TypeVar bound'``, ``'type alias'``,
47+
and ``'type parameter'`` as possible return values.
4248

4349
.. method:: get_id()
4450

@@ -49,6 +55,10 @@ Examining Symbol Tables
4955
Return the table's name. This is the name of the class if the table is
5056
for a class, the name of the function if the table is for a function, or
5157
``'top'`` if the table is global (:meth:`get_type` returns ``'module'``).
58+
For type parameter scopes (which are used for generic classes, functions,
59+
and type aliases), it is the name of the underlying class, function, or
60+
type alias. For type alias scopes, it is the name of the type alias.
61+
For :class:`~typing.TypeVar` bound scopes, it is the name of the ``TypeVar``.
5262

5363
.. method:: get_lineno()
5464

Doc/reference/lexical_analysis.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ Standard C. The recognized escape sequences are:
582582
+-------------------------+---------------------------------+-------+
583583
| ``\v`` | ASCII Vertical Tab (VT) | |
584584
+-------------------------+---------------------------------+-------+
585-
| :samp:`\\{ooo}` | Character with octal value | (2,4) |
585+
| :samp:`\\\\{ooo}` | Character with octal value | (2,4) |
586586
| | *ooo* | |
587587
+-------------------------+---------------------------------+-------+
588588
| :samp:`\\x{hh}` | Character with hex value *hh* | (3,4) |

Doc/tools/.nitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,10 @@ Doc/library/collections.rst
4848
Doc/library/concurrent.futures.rst
4949
Doc/library/configparser.rst
5050
Doc/library/contextlib.rst
51-
Doc/library/copy.rst
5251
Doc/library/csv.rst
5352
Doc/library/datetime.rst
5453
Doc/library/dbm.rst
5554
Doc/library/decimal.rst
56-
Doc/library/difflib.rst
5755
Doc/library/doctest.rst
5856
Doc/library/email.charset.rst
5957
Doc/library/email.compat32-message.rst
@@ -148,7 +146,6 @@ Doc/reference/datamodel.rst
148146
Doc/reference/expressions.rst
149147
Doc/reference/import.rst
150148
Doc/reference/simple_stmts.rst
151-
Doc/tutorial/controlflow.rst
152149
Doc/tutorial/datastructures.rst
153150
Doc/tutorial/introduction.rst
154151
Doc/using/cmdline.rst

0 commit comments

Comments
 (0)