Skip to content

Commit e2ea5de

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-05-31)
Summary: Imported python/cpython `3.15.0b1+` from upstream rev [`487b23d`](https://www.github.com/python/cpython/commit/487b23d546d265cab7809bc166097f7ed0843968) (committed 2026-05-31 20:12:22+00:00). # Commit Info - Base: (`3.15.0b1+`) - [`9a39343`](https://www.github.com/python/cpython/commit/9a393438a7e30f4909c288a90f7637f4ce68e21a) (commit date: 2026-05-31 04:22:11+00:00) - Imported: (`3.15.0b1+`) - [`487b23d`](https://www.github.com/python/cpython/commit/487b23d546d265cab7809bc166097f7ed0843968) (commit date: 2026-05-31 20:12:22+00:00) # Noteworthy file changes - Stdlib files (1 added, 1 removed) - Low-signal files (1 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GOn7tyJfb8V4k2gFAHRM4UaOgFQBbr0LAAAz Differential Revision: D107043262 fbshipit-source-id: d67cdfeab99369b708c5b444f02c67f1fbda04b5
1 parent 442628f commit e2ea5de

13 files changed

Lines changed: 110 additions & 41 deletions

File tree

Doc/library/binascii.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,8 @@ The :mod:`!binascii` module defines the following functions:
367367
*ignorechars* should be a :term:`bytes-like object` containing characters
368368
to ignore from the input.
369369

370-
Similar functionality (accepting only text string arguments, but more
371-
liberal towards whitespace) is also accessible using the
372-
:meth:`bytes.fromhex` class method.
370+
Similar functionality (but more liberal towards whitespace) is also accessible
371+
using the :meth:`bytes.fromhex` class method.
373372

374373
.. versionchanged:: 3.15
375374
Added the *ignorechars* parameter.

Doc/library/copy.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,13 @@ file, socket, window, or any similar types. It does "copy" functions and
7272
classes (shallow and deeply), by returning the original object unchanged; this
7373
is compatible with the way these are treated by the :mod:`pickle` module.
7474

75-
Shallow copies of dictionaries can be made using :meth:`dict.copy`, and
76-
of lists by assigning a slice of the entire list, for example,
77-
``copied_list = original_list[:]``.
75+
Shallow copies of many collections can be made using the corresponding
76+
:meth:`!copy` method (such as :meth:`list.copy`, :meth:`dict.copy` or
77+
:meth:`set.copy`), and of sequences (such as lists or bytearrays) by making
78+
a slice of the entire sequence (``sequence[:]``).
79+
However, these methods and slicing can create an instance of the base type
80+
when copying an instance of a subclass, whereas :func:`copy.copy` normally
81+
returns an instance of the same type.
7882

7983
.. index:: pair: module; pickle
8084

Doc/library/gettext.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ class-based API instead.
5151

5252

5353
.. index:: single: _ (underscore); gettext
54-
.. function:: gettext(message)
54+
.. function:: gettext(message, /)
5555

5656
Return the localized translation of *message*, based on the current global
5757
domain, language, and locale directory. This function is usually aliased as
5858
:func:`!_` in the local namespace (see examples below).
5959

6060

61-
.. function:: dgettext(domain, message)
61+
.. function:: dgettext(domain, message, /)
6262

6363
Like :func:`.gettext`, but look the message up in the specified *domain*.
6464

6565

66-
.. function:: ngettext(singular, plural, n)
66+
.. function:: ngettext(singular, plural, n, /)
6767

6868
Like :func:`.gettext`, but consider plural forms. If a translation is found,
6969
apply the plural formula to *n*, and return the resulting message (some
@@ -78,15 +78,15 @@ class-based API instead.
7878
formulas for a variety of languages.
7979

8080

81-
.. function:: dngettext(domain, singular, plural, n)
81+
.. function:: dngettext(domain, singular, plural, n, /)
8282

8383
Like :func:`ngettext`, but look the message up in the specified *domain*.
8484

8585

86-
.. function:: pgettext(context, message)
87-
.. function:: dpgettext(domain, context, message)
88-
.. function:: npgettext(context, singular, plural, n)
89-
.. function:: dnpgettext(domain, context, singular, plural, n)
86+
.. function:: pgettext(context, message, /)
87+
.. function:: dpgettext(domain, context, message, /)
88+
.. function:: npgettext(context, singular, plural, n, /)
89+
.. function:: dnpgettext(domain, context, singular, plural, n, /)
9090

9191
Similar to the corresponding functions without the ``p`` in the prefix (that
9292
is, :func:`gettext`, :func:`dgettext`, :func:`ngettext`, :func:`dngettext`),
@@ -223,28 +223,28 @@ are the methods of :class:`!NullTranslations`:
223223
translation for a given message.
224224

225225

226-
.. method:: gettext(message)
226+
.. method:: gettext(message, /)
227227

228228
If a fallback has been set, forward :meth:`!gettext` to the fallback.
229229
Otherwise, return *message*. Overridden in derived classes.
230230

231231

232-
.. method:: ngettext(singular, plural, n)
232+
.. method:: ngettext(singular, plural, n, /)
233233

234234
If a fallback has been set, forward :meth:`!ngettext` to the fallback.
235235
Otherwise, return *singular* if *n* is 1; return *plural* otherwise.
236236
Overridden in derived classes.
237237

238238

239-
.. method:: pgettext(context, message)
239+
.. method:: pgettext(context, message, /)
240240

241241
If a fallback has been set, forward :meth:`pgettext` to the fallback.
242242
Otherwise, return the translated message. Overridden in derived classes.
243243

244244
.. versionadded:: 3.8
245245

246246

247-
.. method:: npgettext(context, singular, plural, n)
247+
.. method:: npgettext(context, singular, plural, n, /)
248248

249249
If a fallback has been set, forward :meth:`npgettext` to the fallback.
250250
Otherwise, return the translated message. Overridden in derived classes.
@@ -322,7 +322,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
322322

323323
The following methods are overridden from the base class implementation:
324324

325-
.. method:: gettext(message)
325+
.. method:: gettext(message, /)
326326

327327
Look up the *message* id in the catalog and return the corresponding message
328328
string, as a Unicode string. If there is no entry in the catalog for the
@@ -331,7 +331,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
331331
*message* id is returned.
332332

333333

334-
.. method:: ngettext(singular, plural, n)
334+
.. method:: ngettext(singular, plural, n, /)
335335

336336
Do a plural-forms lookup of a message id. *singular* is used as the message id
337337
for purposes of lookup in the catalog, while *n* is used to determine which
@@ -352,7 +352,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
352352
n) % {'num': n}
353353

354354

355-
.. method:: pgettext(context, message)
355+
.. method:: pgettext(context, message, /)
356356

357357
Look up the *context* and *message* id in the catalog and return the
358358
corresponding message string, as a Unicode string. If there is no
@@ -363,7 +363,7 @@ unexpected, or if other problems occur while reading the file, instantiating a
363363
.. versionadded:: 3.8
364364

365365

366-
.. method:: npgettext(context, singular, plural, n)
366+
.. method:: npgettext(context, singular, plural, n, /)
367367

368368
Do a plural-forms lookup of a message id. *singular* is used as the
369369
message id for purposes of lookup in the catalog, while *n* is used to

Doc/library/math.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,12 @@ Floating point manipulation functions
255255

256256
.. function:: frexp(x)
257257

258-
Return the mantissa and exponent of *x* as the pair ``(m, e)``. *m* is a float
259-
and *e* is an integer such that ``x == m * 2**e`` exactly. If *x* is zero,
260-
returns ``(0.0, 0)``, otherwise ``0.5 <= abs(m) < 1``. This is used to "pick
261-
apart" the internal representation of a float in a portable way.
258+
Return the mantissa and exponent of *x* as the pair ``(m, e)``.
259+
If *x* is a finite nonzero number, then *m* is a float with
260+
``0.5 <= abs(m) < 1.0`` and an integer *e* is such that
261+
``x == m * 2**e`` exactly. Else, return ``(x, 0)``.
262+
This is used to "pick apart" the internal representation of
263+
a float in a portable way.
262264

263265
Note that :func:`frexp` has a different call/return pattern
264266
than its C equivalents: it takes a single argument and return a pair of

Doc/library/mimetypes.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ it converts file extensions to MIME types.
348348

349349
For each ``type`` entry, the script writes a line into the standard output
350350
stream. If an unknown type occurs, it writes an error message into the
351-
standard error stream and exits with the return code ``1``.
351+
standard output stream and exits with the return code ``1``.
352352

353353

354354
.. mimetypes-cli-example:
@@ -375,7 +375,7 @@ interface:
375375
376376
$ # get a MIME type for a rare file extension
377377
$ python -m mimetypes filename.pict
378-
error: unknown extension of filename.pict
378+
error: media type unknown for filename.pict
379379
380380
$ # now look in the extended database built into Python
381381
$ python -m mimetypes --lenient filename.pict
@@ -397,7 +397,8 @@ interface:
397397
$ python -m mimetypes filename.sh filename.nc filename.xxx filename.txt
398398
type: application/x-sh encoding: None
399399
type: application/x-netcdf encoding: None
400-
error: unknown extension of filename.xxx
400+
error: media type unknown for filename.xxx
401+
type: text/plain encoding: None
401402
402403
$ # try to feed an unknown MIME type
403404
$ python -m mimetypes --extension audio/aac audio/opus audio/future audio/x-wav

Doc/library/multiprocessing.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1723,7 +1723,10 @@ inherited by child processes.
17231723
Note that *lock* is a keyword only argument.
17241724

17251725
Note that an array of :data:`ctypes.c_char` has *value* and *raw*
1726-
attributes which allow one to use it to store and retrieve strings.
1726+
attributes which can both be used to store and retrieve byte strings.
1727+
While *raw* allows interaction with a :class:`bytes` object the full size of
1728+
the array, reading *value* will terminate after a null byte, like most
1729+
programming languages handle strings.
17271730

17281731

17291732
The :mod:`!multiprocessing.sharedctypes` module

Doc/library/sched.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ Scheduler Objects
117117
function passed to the constructor) for the next event, then execute it and so
118118
on until there are no more scheduled events.
119119

120-
If *blocking* is false executes the scheduled events due to expire soonest
121-
(if any) and then return the deadline of the next scheduled call in the
122-
scheduler (if any).
120+
If *blocking* is false, immediately executes all events in the queue which have
121+
a time value less than or equal to the current *timefunc* value (if any) and
122+
returns the difference between the current *timefunc* value and the time value
123+
of the next scheduled event in the scheduler's event queue. If the queue is
124+
empty, returns ``None``.
123125

124126
Either *action* or *delayfunc* can raise an exception. In either case, the
125127
scheduler will maintain a consistent state and propagate the exception. If an

Lib/ensurepip/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
__all__ = ["version", "bootstrap"]
13-
_PIP_VERSION = "26.1.1"
13+
_PIP_VERSION = "26.1.2"
1414

1515
# Directory of system wheel packages. Some Linux distribution packaging
1616
# policies recommend against bundling dependencies. For example, Fedora
1.73 MB
Binary file not shown.

Lib/test/test_mimetypes.py

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import unittest.mock
77
from platform import win32_edition
88
from test import support
9-
from test.support import cpython_only, force_not_colorized, os_helper
9+
from test.support import cpython_only, force_not_colorized, os_helper, requires_subprocess
1010
from test.support.import_helper import ensure_lazy_imports
11+
from test.support.script_helper import assert_python_ok, assert_python_failure
1112

1213
try:
1314
import _winapi
@@ -508,5 +509,59 @@ def test_invocation_error(self):
508509
self.assertEqual(result, expected)
509510

510511

512+
@requires_subprocess()
513+
class CommandLineSubprocessTest(unittest.TestCase):
514+
def test_help(self):
515+
rc, stdout, stderr = assert_python_ok('-m', 'mimetypes', '--help')
516+
self.assertIn(b'mimetypes', stdout)
517+
self.assertIn(b'--extension', stdout)
518+
self.assertIn(b'--lenient', stdout)
519+
520+
def test_type_lookup(self):
521+
rc, stdout, stderr = assert_python_ok('-m', 'mimetypes', 'foo.pdf')
522+
self.assertEqual(stdout.strip(), b'type: application/pdf encoding: None')
523+
self.assertEqual(stderr, b'')
524+
525+
def test_type_lookup_unknown(self):
526+
rc, stdout, stderr = assert_python_failure('-m', 'mimetypes', 'foo.unknownext12345')
527+
self.assertEqual(stdout.strip(), b'error: media type unknown for foo.unknownext12345')
528+
self.assertEqual(stderr, b'')
529+
530+
def test_extension_flag(self):
531+
rc, stdout, stderr = assert_python_ok('-m', 'mimetypes', '-e', 'image/jpeg')
532+
self.assertEqual(stdout.strip(), b'.jpg')
533+
self.assertEqual(stderr, b'')
534+
535+
def test_extension_flag_unknown(self):
536+
rc, stdout, stderr = assert_python_failure('-m', 'mimetypes', '-e', 'image/unknowntype12345')
537+
self.assertEqual(stdout.strip(), b'error: unknown type image/unknowntype12345')
538+
self.assertEqual(stderr, b'')
539+
540+
def test_lenient_flag(self):
541+
rc, stdout, stderr = assert_python_ok('-m', 'mimetypes', '-e', '--lenient', 'text/xul')
542+
self.assertIn(b'.xul', stdout)
543+
self.assertEqual(stderr, b'')
544+
545+
def test_multiple_inputs(self):
546+
rc, stdout, stderr = assert_python_ok('-m', 'mimetypes', 'foo.pdf', 'foo.png')
547+
self.assertIn(b'type: application/pdf encoding: None', stdout)
548+
self.assertIn(b'type: image/png encoding: None', stdout)
549+
self.assertEqual(stderr, b'')
550+
551+
def test_multiple_inputs_with_error(self):
552+
rc, stdout, stderr = assert_python_failure(
553+
'-m', 'mimetypes', 'foo.pdf', 'foo.unknownext12345'
554+
)
555+
self.assertIn(b'type: application/pdf encoding: None', stdout)
556+
self.assertIn(b'error: media type unknown for foo.unknownext12345', stdout)
557+
self.assertEqual(stderr, b'')
558+
559+
@force_not_colorized
560+
def test_unknown_flag(self):
561+
rc, stdout, stderr = assert_python_failure('-m', 'mimetypes', '--unknown-flag', 'foo.pdf')
562+
self.assertEqual(stdout, b'')
563+
self.assertIn(b'error: unrecognized arguments: --unknown-flag', stderr)
564+
565+
511566
if __name__ == "__main__":
512567
unittest.main()

0 commit comments

Comments
 (0)