Skip to content

Commit fb8d627

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-07-05)
Summary: Imported python/cpython `3.15.0b3+dev` from upstream rev [`5ae6203`](https://www.github.com/python/cpython/commit/5ae62034e5ef8c9799f08364e06ade9064826e39) (committed 2026-07-05 19:36:51+00:00). # Commit Info - Base: (`3.15.0b3+dev`) - [`7eb476d`](https://www.github.com/python/cpython/commit/7eb476dfbe8a62b02f976ab3211d86e8729c8f91) (commit date: 2026-07-05 02:28:53+00:00) - Imported: (`3.15.0b3+dev`) - [`5ae6203`](https://www.github.com/python/cpython/commit/5ae62034e5ef8c9799f08364e06ade9064826e39) (commit date: 2026-07-05 19:36:51+00:00) # Noteworthy file changes - Low-signal files (7 added, 3 removed) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GN-c1yV9PGuHJKEFALJIOjcSdIUbbr0LAAAz Differential Revision: D110718115 fbshipit-source-id: c80d29cd378a0951c60e50e849197cd7b857e6dc
1 parent 84c6ddd commit fb8d627

36 files changed

Lines changed: 1312 additions & 529 deletions

Doc/c-api/lifecycle.dot.pdf

-18.9 KB
Binary file not shown.

Doc/c-api/lifecycle.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ object's life. An arrow from *A* to *B* indicates that event *B* can occur
1919
after event *A* has occurred, with the arrow's label indicating the condition
2020
that must be true for *B* to occur after *A*.
2121

22-
.. only:: html and not epub
22+
.. only:: builder_html
2323

2424
.. raw:: html
2525

@@ -50,20 +50,13 @@ that must be true for *B* to occur after *A*.
5050
})();
5151
</script>
5252
53-
.. only:: epub or not (html or latex)
53+
.. only:: not builder_html
5454
5555
.. image:: lifecycle.dot.svg
5656
:align: center
5757
:class: invert-in-dark-mode
5858
:alt: Diagram showing events in an object's life. Explained in detail below.
5959
60-
.. only:: latex
61-
62-
.. image:: lifecycle.dot.pdf
63-
:align: center
64-
:class: invert-in-dark-mode
65-
:alt: Diagram showing events in an object's life. Explained in detail below.
66-
6760
.. container::
6861
:name: life-events-graph-description
6962

Doc/library/http.server.rst

Lines changed: 60 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,17 @@ handler. Code to create and run the server looks like this::
3939
This class builds on the :class:`~socketserver.TCPServer` class by storing
4040
the server address as instance variables named :attr:`server_name` and
4141
:attr:`server_port`. The server is accessible by the handler, typically
42-
through the handler's :attr:`server` instance variable.
42+
through the handler's :attr:`~socketserver.BaseRequestHandler.server`
43+
instance variable.
44+
45+
.. attribute:: server_name
46+
47+
The HTTP server's fully qualified domain name.
48+
49+
.. attribute:: server_port
50+
51+
The HTTP server's port number obtained from *server_address*.
52+
4353

4454
.. class:: ThreadingHTTPServer(server_address, RequestHandlerClass)
4555

@@ -60,7 +70,7 @@ handler. Code to create and run the server looks like this::
6070
object fails with a :exc:`RuntimeError`.
6171

6272
The *certfile* argument is the path to the SSL certificate chain file,
63-
and the *keyfile* is the path to file containing the private key.
73+
and the *keyfile* is the path to the file containing the private key.
6474

6575
A *password* can be specified for files protected and wrapped with PKCS#8,
6676
but beware that this could possibly expose hardcoded passwords in clear.
@@ -140,7 +150,7 @@ instantiation, of which this module provides three different variants:
140150

141151
.. attribute:: path
142152

143-
Contains the request path. If query component of the URL is present,
153+
Contains the request path. If the query component of the URL is present,
144154
then ``path`` includes the query. Using the terminology of :rfc:`3986`,
145155
``path`` here includes ``hier-part`` and the ``query``.
146156

@@ -190,7 +200,7 @@ instantiation, of which this module provides three different variants:
190200
Specifies a format string that should be used by :meth:`send_error` method
191201
for building an error response to the client. The string is filled by
192202
default with variables from :attr:`responses` based on the status code
193-
that passed to :meth:`send_error`.
203+
passed to :meth:`send_error`.
194204

195205
.. attribute:: error_content_type
196206

@@ -238,8 +248,8 @@ instantiation, of which this module provides three different variants:
238248
.. method:: handle_expect_100()
239249

240250
When an HTTP/1.1 conformant server receives an ``Expect: 100-continue``
241-
request header it responds back with a ``100 Continue`` followed by ``200
242-
OK`` headers.
251+
request header it responds with a ``100 Continue`` followed by ``200 OK``
252+
headers.
243253
This method can be overridden to raise an error if the server does not
244254
want the client to continue. For example, the server can choose to send ``417
245255
Expectation Failed`` as a response header and ``return False``.
@@ -295,8 +305,8 @@ instantiation, of which this module provides three different variants:
295305
.. method:: send_response_only(code, message=None)
296306

297307
Sends the response header only, used for the purposes when ``100
298-
Continue`` response is sent by the server to the client. The headers not
299-
buffered and sent directly the output stream.If the *message* is not
308+
Continue`` response is sent by the server to the client. The headers are
309+
not buffered and sent directly the output stream. If the *message* is not
300310
specified, the HTTP message corresponding the response *code* is sent.
301311

302312
This method does not reject *message* containing CRLF sequences.
@@ -338,7 +348,7 @@ instantiation, of which this module provides three different variants:
338348
to create custom error logging mechanisms. The *format* argument is a
339349
standard printf-style format string, where the additional arguments to
340350
:meth:`log_message` are applied as inputs to the formatting. The client
341-
ip address and current date and time are prefixed to every message logged.
351+
IP address and current date and time are prefixed to every message logged.
342352

343353
.. method:: version_string()
344354

@@ -402,6 +412,14 @@ instantiation, of which this module provides three different variants:
402412

403413
.. versionadded:: 3.15
404414

415+
.. attribute:: index_pages
416+
417+
Specifies the filenames that are treated as directory index pages.
418+
419+
Defaults to ``("index.html", "index.htm")``.
420+
421+
.. versionadded:: 3.12
422+
405423
.. attribute:: extensions_map
406424

407425
A dictionary mapping suffixes into MIME types, contains custom overrides
@@ -434,8 +452,8 @@ instantiation, of which this module provides three different variants:
434452
The request is mapped to a local file by interpreting the request as a
435453
path relative to the current working directory.
436454

437-
If the request was mapped to a directory, the directory is checked for a
438-
file named ``index.html`` or ``index.htm`` (in that order). If found, the
455+
If the request was mapped to a directory, the directory is checked for
456+
an index page as specified by :attr:`index_pages`. If found, the
439457
file's contents are returned; otherwise a directory listing is generated
440458
by calling the :meth:`list_directory` method. This method uses
441459
:func:`os.listdir` to scan the directory, and returns a ``404`` error
@@ -465,9 +483,32 @@ instantiation, of which this module provides three different variants:
465483
.. versionchanged:: 3.7
466484
Support of the ``'If-Modified-Since'`` header.
467485

468-
The :class:`SimpleHTTPRequestHandler` class can be used in the following
469-
manner in order to create a very basic webserver serving files relative to
470-
the current directory::
486+
.. method:: list_directory(path)
487+
488+
Helper to list the contents of *path* when no index page is present.
489+
490+
This returns either a :term:`file-like object` (which must be closed
491+
by the caller) or ``None`` to indicate an error, in which case the
492+
caller has nothing further to do. In either case, the headers are sent.
493+
494+
.. method:: guess_type(path)
495+
496+
Guess the type of the file at the given *path*.
497+
498+
This returns a string of the form ``type/subtype``, usable for
499+
a MIME Content-type header.
500+
501+
The default implementation looks the file's extension up in
502+
:attr:`extensions_map`, falling back to
503+
:func:`mimetypes.guess_file_type` and then to
504+
:attr:`default_content_type`.
505+
506+
.. versionchanged:: 3.13
507+
Add :func:`mimetypes.guess_file_type` as a fallback.
508+
509+
510+
The :class:`SimpleHTTPRequestHandler` class can be used to create a very basic
511+
webserver serving files relative to the current directory as follows::
471512

472513
import http.server
473514
import socketserver
@@ -483,7 +524,7 @@ the current directory::
483524

484525
:class:`SimpleHTTPRequestHandler` can also be subclassed to enhance behavior,
485526
such as using different index file names by overriding the class attribute
486-
:attr:`index_pages`.
527+
:attr:`~SimpleHTTPRequestHandler.index_pages`.
487528

488529

489530
.. _http-server-cli:
@@ -599,8 +640,8 @@ The following options are accepted:
599640

600641
.. option:: -H, --header <header> <value>
601642

602-
Specify an additional extra HTTP Response Header to send on successful HTTP
603-
200 responses. Can be used multiple times to send additional custom response
643+
Specify an additional HTTP Response Header to send on successful HTTP 200
644+
responses. Can be used multiple times to send additional custom response
604645
headers. Headers that are sent automatically by the server (for instance
605646
Content-Type) will not be overwritten by the server.
606647

@@ -615,13 +656,13 @@ Security considerations
615656
.. index:: pair: http.server; security
616657

617658
:class:`SimpleHTTPRequestHandler` will follow symbolic links when handling
618-
requests, this makes it possible for files outside of the specified directory
659+
requests which makes it possible for files outside of the specified directory
619660
to be served.
620661

621662
Methods :meth:`BaseHTTPRequestHandler.send_header` and
622663
:meth:`BaseHTTPRequestHandler.send_response_only` assume sanitized input
623664
and do not perform input validation such as checking for the presence of CRLF
624-
sequences. Untrusted input may result in HTTP Header injection attacks.
665+
sequences. Untrusted input may result in HTTP header injection attacks.
625666

626667
Earlier versions of Python did not scrub control characters from the
627668
log messages emitted to stderr from ``python -m http.server`` or the

Doc/library/imaplib.rst

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
This module defines three classes, :class:`IMAP4`, :class:`IMAP4_SSL` and
1717
:class:`IMAP4_stream`, which encapsulate a connection to an IMAP4 server and
1818
implement a large subset of the IMAP4rev1 client protocol as defined in
19-
:rfc:`2060`. It is backward compatible with IMAP4 (:rfc:`1730`) servers, but
19+
:rfc:`3501`. It is backward compatible with IMAP4 (:rfc:`1730`) servers, but
2020
note that the ``STATUS`` command is not supported in IMAP4.
2121

2222
.. include:: ../includes/wasm-notavail.rst
@@ -127,21 +127,23 @@ The second subclass allows for connections created by a child process:
127127
The following utility functions are defined:
128128

129129

130-
.. function:: Internaldate2tuple(datestr)
130+
.. function:: Internaldate2tuple(resp)
131131

132-
Parse an IMAP4 ``INTERNALDATE`` string and return corresponding local
133-
time. The return value is a :class:`time.struct_time` tuple or
134-
``None`` if the string has wrong format.
132+
Parse a :term:`bytes-like object` containing an IMAP4 ``INTERNALDATE``
133+
response and return the corresponding local time. The return value is a
134+
:class:`time.struct_time` tuple or ``None`` if the input has wrong format.
135135

136136
.. function:: Int2AP(num)
137137

138138
Converts an integer into a bytes representation using characters from the set
139139
[``A`` .. ``P``].
140140

141141

142-
.. function:: ParseFlags(flagstr)
142+
.. function:: ParseFlags(resp)
143143

144-
Converts an IMAP4 ``FLAGS`` response to a tuple of individual flags.
144+
Converts a :term:`bytes-like object` containing an IMAP4 ``FLAGS`` response
145+
to a tuple of individual flags as :class:`bytes`. The return value is an
146+
empty tuple if the input has wrong format.
145147

146148

147149
.. function:: Time2Internaldate(date_time)
@@ -186,6 +188,9 @@ enclosed with either parentheses or double quotes) each string is quoted.
186188
However, the *password* argument to the ``LOGIN`` command is always quoted. If
187189
you want to avoid having an argument string quoted (eg: the *flags* argument to
188190
``STORE``) then enclose the string in parentheses (eg: ``r'(\Deleted)'``).
191+
In general, pass arguments unquoted and let the module quote them as needed.
192+
An argument that is already enclosed in double quotes is left unchanged,
193+
so that code which quotes arguments itself keeps working.
189194

190195
Most commands return a tuple: ``(type, [data, ...])`` where *type* is usually
191196
``'OK'`` or ``'NO'``, and *data* is either the text from the command response,
@@ -206,6 +211,11 @@ An :class:`IMAP4` instance has the following methods:
206211

207212
Append *message* to named mailbox.
208213

214+
*flags* may be ``None`` or a string of IMAP flag tokens. Multiple
215+
flags are separated by spaces, for example ``r'\Seen \Answered'``.
216+
If *flags* is not already enclosed in parentheses, parentheses are
217+
added automatically.
218+
209219

210220
.. method:: IMAP4.authenticate(mechanism, authobject)
211221

@@ -394,7 +404,7 @@ An :class:`IMAP4` instance has the following methods:
394404
.. versionadded:: 3.14
395405

396406

397-
.. method:: IMAP4.list([directory[, pattern]])
407+
.. method:: IMAP4.list(directory='', pattern='*')
398408

399409
List mailbox names in *directory* matching *pattern*. *directory* defaults to
400410
the top-level mail folder, and *pattern* defaults to match anything. Returned
@@ -424,7 +434,7 @@ An :class:`IMAP4` instance has the following methods:
424434
The method no longer ignores silently arbitrary exceptions.
425435

426436

427-
.. method:: IMAP4.lsub(directory='""', pattern='*')
437+
.. method:: IMAP4.lsub(directory='', pattern='*')
428438

429439
List subscribed mailbox names in directory matching pattern. *directory*
430440
defaults to the top level directory and *pattern* defaults to match any mailbox.
@@ -611,7 +621,7 @@ An :class:`IMAP4` instance has the following methods:
611621
.. method:: IMAP4.store(message_set, command, flag_list)
612622

613623
Alters flag dispositions for messages in mailbox. *command* is specified by
614-
section 6.4.6 of :rfc:`2060` as being one of "FLAGS", "+FLAGS", or "-FLAGS",
624+
section 6.4.6 of :rfc:`3501` as being one of "FLAGS", "+FLAGS", or "-FLAGS",
615625
optionally with a suffix of ".SILENT".
616626

617627
For example, to set the delete flag on all messages::
@@ -625,11 +635,11 @@ An :class:`IMAP4` instance has the following methods:
625635

626636
Creating flags containing ']' (for example: "[test]") violates
627637
:rfc:`3501` (the IMAP protocol). However, imaplib has historically
628-
allowed creation of such tags, and popular IMAP servers, such as Gmail,
638+
allowed creation of such flags, and popular IMAP servers, such as Gmail,
629639
accept and produce such flags. There are non-Python programs which also
630-
create such tags. Although it is an RFC violation and IMAP clients and
640+
create such flags. Although it is an RFC violation and IMAP clients and
631641
servers are supposed to be strict, imaplib still continues to allow
632-
such tags to be created for backward compatibility reasons, and as of
642+
such flags to be created for backward compatibility reasons, and as of
633643
Python 3.6, handles them if they are sent from the server, since this
634644
improves real-world compatibility.
635645

Doc/library/re.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,9 @@ The special characters are:
509509
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
510510
optional and can be omitted. For example,
511511
``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which
512-
will match with ``'<user@host.com>'`` as well as ``'user@host.com'``, but
513-
not with ``'<user@host.com'`` nor ``'user@host.com>'``.
512+
matches ``'<user@host.com>'`` as well as ``'user@host.com'``, but does not
513+
match ``'<user@host.com'`` nor ``'user@host.com>'`` in their entirety
514+
(:func:`re.search` finds only ``'user@host.com'`` in the former).
514515

515516
.. versionchanged:: 3.12
516517
Group *id* can only contain ASCII digits.

Doc/library/tkinter.rst

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ method on it, and to change its value you call the :meth:`!set` method.
656656
If you follow this protocol, the widget will always track the value of the
657657
variable, with no further intervention on your part.
658658

659+
Keep a reference to the variable for as long as a widget uses it, for example
660+
by storing it as an attribute (see :class:`Variable`).
661+
659662
For example::
660663

661664
import tkinter as tk
@@ -734,6 +737,8 @@ Here are some examples of typical usage::
734737
myapp.mainloop()
735738

736739

740+
.. _Tk-option-data-types:
741+
737742
Tk option data types
738743
^^^^^^^^^^^^^^^^^^^^
739744

@@ -767,12 +772,16 @@ color
767772
represent any legal hex digit. See page 160 of Ousterhout's book for details.
768773

769774
cursor
770-
The standard X cursor names from :file:`cursorfont.h` can be used, without the
771-
``XC_`` prefix. For example to get a hand cursor (``XC_hand2``), use the
772-
string ``"hand2"``. You can also specify a bitmap and mask file of your own.
775+
The name of the mouse cursor to display while the pointer is over the widget.
776+
Tk provides a portable set of cursor names available on all platforms
777+
(for example ``"arrow"``, ``"watch"``, ``"cross"``, or ``"hand2"``);
778+
the standard X cursor names from :file:`cursorfont.h` may also be used,
779+
without the ``XC_`` prefix (so ``XC_hand2`` becomes ``"hand2"``).
780+
The full list of names, including the platform-specific ones,
781+
is given in the :manpage:`cursors(3tk)` manual page.
782+
You can also specify a bitmap and mask file of your own.
773783
On Windows a cursor file (:file:`.cur` or :file:`.ani`) may be used directly,
774784
giving its path preceded with an ``@``, as in ``"@C:/cursors/bart.ani"``.
775-
See page 179 of Ousterhout's book.
776785

777786
distance
778787
Screen distances can be specified in either pixels or absolute distances.
@@ -2020,6 +2029,7 @@ Base and mixin classes
20202029

20212030
Return the geometry of the widget, in the form ``widthxheight+x+y``.
20222031
All dimensions are in pixels.
2032+
An offset can be negative; see :meth:`~Wm.geometry`.
20232033

20242034
.. method:: winfo_height()
20252035

@@ -2480,6 +2490,8 @@ Base and mixin classes
24802490
*width* and *height* are in pixels (or grid units for a gridded window);
24812491
a position preceded by ``+`` is measured from the left or top edge of the
24822492
screen and one preceded by ``-`` from the right or bottom edge.
2493+
An offset can be negative, as in ``'200x100+-9+-8'``, when the window
2494+
edge is positioned beyond the corresponding screen edge.
24832495
An empty string cancels any user-specified geometry, letting the window
24842496
revert to its natural size.
24852497
With no argument, return the current geometry as a string of the form
@@ -5733,6 +5745,14 @@ Variable classes
57335745
:class:`StringVar`, :class:`IntVar`, :class:`DoubleVar` or
57345746
:class:`BooleanVar` -- rather than :class:`!Variable` directly.
57355747

5748+
.. note::
5749+
5750+
When a :class:`!Variable` is garbage collected, its Tcl variable is unset.
5751+
Keep a reference to it for as long as a widget is linked to it, for example
5752+
by storing it as an attribute rather than in a local variable.
5753+
Otherwise Tk recreates the Tcl variable to keep the widget working, but it
5754+
is never unset again, leaking one Tcl variable per dropped wrapper.
5755+
57365756
.. versionchanged:: 3.10
57375757
Two variables now compare equal (``==``) only when they have the same
57385758
name, are of the same class, and belong to the same Tcl interpreter.

0 commit comments

Comments
 (0)