Skip to content

Commit 2c9fe7a

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython main branch from GitHub (2026-08-23)
Summary: Imported python/cpython `3.16.0a0` from upstream rev [`53d2e14`](https://www.github.com/python/cpython/commit/53d2e14a3081085a12c65cff14de77604da14670) (committed 2026-08-23 19:52:58+00:00). # Commit Info - Base: (`3.16.0a0`) - [`b062727`](https://www.github.com/python/cpython/commit/b062727097e997bcb900e11503d3248daac903da) (commit date: 2026-08-22 18:45:59+00:00) - Imported: (`3.16.0a0`) - [`53d2e14`](https://www.github.com/python/cpython/commit/53d2e14a3081085a12c65cff14de77604da14670) (commit date: 2026-08-23 19:52:58+00:00) # Noteworthy file changes - Low-signal files (9 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GOwXvC6am1X94jljAGoOYLhmZlJsbr0LAAAz Differential Revision: D117156581 fbshipit-source-id: 532fa32323514a27509a099658bf06804f3d62c6
1 parent 85fb30a commit 2c9fe7a

69 files changed

Lines changed: 2867 additions & 1643 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/library/asyncio-stream.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ and work with streams:
4949

5050

5151
.. function:: open_connection(host=None, port=None, *, \
52-
limit=None, ssl=None, family=0, proto=0, \
52+
limit=65536, ssl=None, family=0, proto=0, \
5353
flags=0, sock=None, local_addr=None, \
5454
server_hostname=None, ssl_handshake_timeout=None, \
5555
ssl_shutdown_timeout=None, \
@@ -89,7 +89,7 @@ and work with streams:
8989

9090

9191
.. function:: start_server(client_connected_cb, host=None, \
92-
port=None, *, limit=None, \
92+
port=None, *, limit=65536, \
9393
family=socket.AF_UNSPEC, \
9494
flags=socket.AI_PASSIVE, sock=None, \
9595
backlog=100, ssl=None, reuse_address=None, \
@@ -137,7 +137,7 @@ and work with streams:
137137

138138
.. rubric:: Unix Sockets
139139

140-
.. function:: open_unix_connection(path=None, *, limit=None, \
140+
.. function:: open_unix_connection(path=None, *, limit=65536, \
141141
ssl=None, sock=None, server_hostname=None, \
142142
ssl_handshake_timeout=None, ssl_shutdown_timeout=None)
143143
:async:
@@ -169,7 +169,7 @@ and work with streams:
169169

170170

171171
.. function:: start_unix_server(client_connected_cb, path=None, \
172-
*, limit=None, sock=None, backlog=100, ssl=None, \
172+
*, limit=65536, sock=None, backlog=100, ssl=None, \
173173
ssl_handshake_timeout=None, \
174174
ssl_shutdown_timeout=None, start_serving=True, \
175175
cleanup_socket=True, mode=None)

Doc/library/asyncio-subprocess.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Creating Subprocesses
6262
=====================
6363

6464
.. function:: create_subprocess_exec(program, *args, stdin=None, \
65-
stdout=None, stderr=None, limit=None, **kwds)
65+
stdout=None, stderr=None, limit=65536, **kwds)
6666
:async:
6767
6868
Create a subprocess.
@@ -84,7 +84,7 @@ Creating Subprocesses
8484

8585

8686
.. function:: create_subprocess_shell(cmd, stdin=None, \
87-
stdout=None, stderr=None, limit=None, **kwds)
87+
stdout=None, stderr=None, limit=65536, **kwds)
8888
:async:
8989
9090
Run the *cmd* shell command.

Doc/library/curses.rst

Lines changed: 109 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ Linux and the BSD variants of Unix.
2727

2828
Whenever the documentation mentions a *character* it can be specified
2929
as an integer, a one-character Unicode string or a one-byte byte string.
30+
An integer is the code of a single encoded byte, optionally combined with
31+
attributes and a color pair, as returned by :meth:`window.inch`.
32+
Methods that write to a window accept also a character cell: a Unicode
33+
string of a spacing character followed by combining characters, or a
34+
:class:`complexchar`.
3035

3136
Whenever the documentation mentions a *character string* it can be specified
3237
as a Unicode string or a byte string.
38+
Methods that write to a window accept also a :class:`complexstr`.
3339

3440
.. note::
3541

@@ -364,9 +370,9 @@ Keyboard input
364370
Push *ch* so the next :meth:`~window.getch` or :meth:`~window.get_wch` will
365371
return it.
366372

367-
*ch* may be an integer (a key code or character code), a byte, or a string of
368-
length 1. A one-character string is pushed like :func:`unget_wch`; on a
369-
narrow build it must encode to a single byte.
373+
*ch* may be an integer (a key code or the code of an encoded byte), a byte,
374+
or a string of length 1. A one-character string is pushed like
375+
:func:`unget_wch`; on a narrow build it must encode to a single byte.
370376

371377
.. note::
372378

@@ -380,6 +386,9 @@ Keyboard input
380386

381387
Push *ch* so the next :meth:`~window.get_wch` will return it.
382388

389+
*ch* may be an integer (a character code, not a key code) or a string of
390+
length 1.
391+
383392
.. note::
384393

385394
Only one *ch* can be pushed before :meth:`!get_wch` is called.
@@ -1015,7 +1024,7 @@ Terminfo database
10151024
.. function:: tparm(str[, ...])
10161025

10171026
Instantiate the bytes object *str* with the supplied parameters, where *str* should
1018-
be a parameterized string obtained from the terminfo database. For example,
1027+
be a parameterized byte string obtained from the terminfo database. For example,
10191028
``tparm(tigetstr("cup"), 5, 3)`` could result in ``b'\033[6;4H'``, the exact
10201029
result depending on terminal type. Up to nine integer parameters may be supplied.
10211030

@@ -1024,8 +1033,8 @@ Terminfo database
10241033
.. function:: putp(str)
10251034

10261035
Equivalent to ``tputs(str, 1, putchar)``; emit the value of a specified
1027-
terminfo capability for the current terminal. Note that the output of :func:`putp`
1028-
always goes to standard output.
1036+
terminfo capability, a bytes object, for the current terminal.
1037+
Note that the output of :func:`putp` always goes to standard output.
10291038

10301039
:func:`setupterm` (or :func:`initscr`) must be called first.
10311040

@@ -1035,9 +1044,15 @@ Utilities
10351044

10361045
.. function:: unctrl(ch)
10371046

1038-
Return a bytes object which is a printable representation of the character *ch*.
1039-
*ch* cannot be a character that does not fit in a single byte; use
1040-
:func:`wunctrl` for those.
1047+
Return a bytes object which is a printable representation of the character *ch*;
1048+
any attributes and color pair are ignored.
1049+
Control characters are represented as a caret followed by a character,
1050+
for example as ``b'^C'``.
1051+
Printing characters are left as they are.
1052+
The representation of other characters is defined by the underlying curses
1053+
library.
1054+
1055+
*ch* must fit in a single byte; use :func:`wunctrl` for other characters.
10411056

10421057
.. function:: wunctrl(ch)
10431058

@@ -1264,19 +1279,47 @@ Reading input
12641279

12651280
.. method:: window.getch([y, x])
12661281

1267-
Get a character. Note that the integer returned does *not* have to be in ASCII
1268-
range: function keys, keypad keys and so on are represented by numbers higher
1269-
than 255. In no-delay mode, return ``-1`` if there is no input, otherwise
1270-
wait until a key is pressed.
1271-
A multibyte character is returned as its encoded bytes one at a time; use
1272-
:meth:`get_wch` to read it as a single character.
1282+
Read a key press, after moving the cursor to *y*, *x* if specified,
1283+
and return it as an integer.
1284+
The window is refreshed first if it is not a pad and was modified since
1285+
the last refresh.
1286+
Wait until a key is pressed, or return ``-1`` if the read is non-blocking
1287+
or times out (see :meth:`nodelay` and :meth:`timeout`).
1288+
1289+
An ordinary key is returned as the code of a single byte of its encoding
1290+
in the current locale,
1291+
so a character encoded with several bytes takes several calls.
1292+
For example, in a UTF-8 locale ``'é'`` is read as ``195``, then ``169``.
1293+
Use :meth:`get_wch` to read it as a single character.
1294+
1295+
In keypad mode (see :meth:`keypad`) function keys and other special keys
1296+
are returned as one of the :ref:`KEY_* constants <curses-key-constants>`,
1297+
which cannot be mistaken for an ordinary key.
1298+
Otherwise, or if their escape sequence does not arrive in time
1299+
(see :meth:`notimeout` and :func:`set_escdelay`),
1300+
their bytes are returned one at a time.
1301+
1302+
In echo mode (see :func:`echo`) the key is added to the window as by
1303+
:meth:`addch`; special keys are not echoed.
12731304

12741305
.. method:: window.get_wch([y, x])
12751306

1276-
Get a wide character. Return a character for most keys, or an integer for
1277-
function keys, keypad keys, and other special keys. Unlike :meth:`getch`, an
1278-
ordinary key is returned as a one-character :class:`str`.
1279-
In no-delay mode, raise an exception if there is no input.
1307+
Read a key press, after moving the cursor to *y*, *x* if specified,
1308+
and return it as a one-character :class:`str`.
1309+
The window is refreshed first if it is not a pad and was modified since
1310+
the last refresh.
1311+
Wait until a key is pressed, or raise :exc:`error` if the read is
1312+
non-blocking or times out (see :meth:`nodelay` and :meth:`timeout`).
1313+
1314+
In keypad mode (see :meth:`keypad`) function keys and other special keys
1315+
are returned as one of the :ref:`KEY_* constants <curses-key-constants>`,
1316+
an integer.
1317+
Otherwise, or if their escape sequence does not arrive in time
1318+
(see :meth:`notimeout` and :func:`set_escdelay`),
1319+
their characters are returned one at a time.
1320+
1321+
In echo mode (see :func:`echo`) the key is added to the window as by
1322+
:meth:`addch`; special keys are not echoed.
12801323

12811324
.. versionadded:: 3.3
12821325

@@ -1286,21 +1329,24 @@ Reading input
12861329

12871330
.. method:: window.getkey([y, x])
12881331

1289-
Get a character, returning a string instead of an integer, as :meth:`getch`
1290-
does. Function keys, keypad keys and other special keys return a multibyte
1291-
string containing the key name. In no-delay mode, raise an exception if
1292-
there is no input.
1332+
Read a key press as :meth:`getch` does, but return it as a :class:`str`:
1333+
an ordinary key as a one-character string, the byte decoded as Latin-1,
1334+
and a special key as its name, such as ``'KEY_UP'`` (see :func:`keyname`).
1335+
Raise :exc:`error` instead of returning ``-1`` if there is no input.
12931336

12941337
.. method:: window.getstr()
12951338
window.getstr(n)
12961339
window.getstr(y, x)
12971340
window.getstr(y, x, n)
12981341

1299-
Read a bytes object from the user, with primitive line editing capacity.
1300-
At most *n* characters are read;
1342+
Read a line of input from the user, with primitive line editing capacity,
1343+
after moving the cursor to *y*, *x* if specified.
1344+
Return it as a bytes object, in the encoding of the current locale
1345+
and without the terminating newline.
1346+
At most *n* bytes are read;
13011347
*n* defaults to and cannot exceed 2047.
1302-
A multibyte character is returned as its encoded bytes; use :meth:`get_wstr`
1303-
to read the input as a :class:`str`.
1348+
1349+
Use :meth:`get_wstr` to read the input as a :class:`str`.
13041350

13051351
.. versionchanged:: 3.14
13061352
The maximum value for *n* was increased from 1023 to 2047.
@@ -1310,10 +1356,13 @@ Reading input
13101356
window.get_wstr(y, x)
13111357
window.get_wstr(y, x, n)
13121358

1313-
Read a string from the user, with primitive line editing capacity.
1314-
Unlike :meth:`getstr`, it can return characters that are not representable in
1315-
the window's encoding.
1316-
At most *n* characters are read; *n* defaults to and cannot exceed 2047.
1359+
Read a line of input from the user, with primitive line editing capacity,
1360+
after moving the cursor to *y*, *x* if specified.
1361+
Return it as a :class:`str`, without the terminating newline.
1362+
At most *n* characters are read;
1363+
*n* defaults to and cannot exceed 2047.
1364+
1365+
This is the wide-character variant of :meth:`getstr`.
13171366

13181367
.. versionadded:: next
13191368

@@ -1354,41 +1403,45 @@ Reading window contents
13541403
.. method:: window.instr([n])
13551404
window.instr(y, x[, n])
13561405

1357-
Return a bytes object of characters, extracted from the window starting at the
1358-
current cursor position, or at *y*, *x* if specified, and stopping at the end
1359-
of the line. Attributes and color information are stripped
1360-
from the characters. If *n* is specified, :meth:`instr` returns a string
1361-
at most *n* characters long (exclusive of the trailing NUL).
1362-
The maximum value for *n* is 2047.
1363-
A character not representable in the window's encoding cannot be returned;
1406+
Read the text of the window from the current cursor position,
1407+
or from *y*, *x* if specified, to the end of the line
1408+
or at most *n* bytes if *n* is specified,
1409+
and return it as a bytes object, in the encoding of the current locale.
1410+
Attributes and color pairs are stripped;
1411+
use :meth:`in_wchstr` to read them too.
1412+
A character not representable in the encoding cannot be returned;
13641413
use :meth:`in_wstr` for those.
13651414

13661415
.. versionchanged:: 3.14
13671416
The maximum value for *n* was increased from 1023 to 2047.
13681417

1418+
.. versionchanged:: next
1419+
*n* is no longer limited to 2047.
1420+
13691421
.. method:: window.in_wstr([n])
13701422
window.in_wstr(y, x[, n])
13711423

1372-
Return a string of characters, extracted from the window starting at the
1373-
current cursor position, or at *y*, *x* if specified. Unlike :meth:`instr`,
1374-
it can return characters that are not representable in the window's encoding.
1375-
Attributes and color information are stripped from the characters. The
1376-
maximum value for *n* is 2047.
1424+
Read the text of the window from the current cursor position,
1425+
or from *y*, *x* if specified, to the end of the line
1426+
or at most *n* characters if *n* is specified,
1427+
and return it as a :class:`str`.
1428+
Attributes and color pairs are stripped;
1429+
use :meth:`in_wchstr` to read them too.
1430+
1431+
This is the wide-character variant of :meth:`instr`.
13771432

13781433
.. versionadded:: next
13791434

13801435
.. method:: window.in_wchstr([n])
13811436
window.in_wchstr(y, x[, n])
13821437

1383-
Return a :class:`complexstr` of the styled cells extracted from the window
1384-
starting at the current cursor position, or at *y*, *x* if specified, and
1385-
stopping at the end of the line. This is the variant of :meth:`instr` and
1386-
:meth:`in_wstr` that *keeps* each cell's attributes and color pair (those
1387-
methods strip the rendition). If *n* is specified, at most *n* cells are
1388-
returned. The maximum value for *n* is 2047.
1389-
1390-
The result can be written back unchanged with :meth:`addstr` (a read and a
1391-
re-write is a round-trip that preserves every cell's rendition).
1438+
Read the styled cells of the window from the current cursor position,
1439+
or from *y*, *x* if specified, to the end of the line
1440+
or at most *n* cells if *n* is specified,
1441+
and return them as a :class:`complexstr`.
1442+
Unlike :meth:`instr` and :meth:`in_wstr`, each cell keeps its attributes
1443+
and color pair, so the result can be written back unchanged
1444+
with :meth:`addstr`.
13921445

13931446
.. versionadded:: next
13941447

@@ -1835,6 +1888,8 @@ Input options
18351888
If *flag* is ``True``, escape sequences generated by some keys (keypad, function keys)
18361889
will be interpreted by :mod:`!curses`. If *flag* is ``False``, escape sequences will be
18371890
left as is in the input stream.
1891+
Keypad mode is disabled by default, but :func:`wrapper` enables it for the
1892+
main window.
18381893

18391894
.. method:: window.nodelay(flag)
18401895

@@ -2331,6 +2386,8 @@ by some methods.
23312386
| .. data:: A_COLOR | | Bit-mask to extract color-pair field information |
23322387
+-------------------------+--------------------------+--------------------------------------------------+
23332388

2389+
.. _curses-key-constants:
2390+
23342391
Keys
23352392
~~~~
23362393

Doc/library/difflib.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ This module provides classes and functions for comparing sequences.
1717
Most of them compare sequences of text lines (for example lists of strings,
1818
or :term:`file objects <file object>`) and
1919
produce :dfn:`diffs` -- reports on the differences.
20-
Diffs can be produced in in various formats, including HTML and context
20+
Diffs can be produced in various formats, including HTML and context
2121
and unified diffs -- formats produced by tools like
2222
:manpage:`diff <diff(1)>` and :manpage:`git diff <git-diff(1)>`.
2323

@@ -52,7 +52,7 @@ By default, if the second input sequence is at least 200 items long, items
5252
that account for more than 1% it are considered *junk*.
5353

5454
Depending on your data, you should consider turning this heuristic off
55-
(setting :class:`~difflib.SequenceMatcher`'s *autojunk* argument to to ``False``)
55+
(setting :class:`~difflib.SequenceMatcher`'s *autojunk* argument to ``False``)
5656
or tuning it (using the *isjunk* argument, perhaps to one of the
5757
:ref:`predefined functions <difflib-isjunk-functions>`).
5858

0 commit comments

Comments
 (0)