Skip to content

Commit 10a5565

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.7+ stable branch (2026-08-14)
Summary: Imported python/cpython `3.14.7+` from upstream rev [`f734bce`](https://www.github.com/python/cpython/commit/f734bce1693ae9ccfef2072c8a7a2acc6fc4003a) (committed 2026-08-14 04:11:19+00:00). # Commit Info - Base: (`3.14.7+`) - [`d755701`](https://www.github.com/python/cpython/commit/d755701b2aa35d7ec05f16fea410191f034e85c1) (commit date: 2026-08-12 20:11:28+00:00) - Imported: (`3.14.7+`) - [`f734bce`](https://www.github.com/python/cpython/commit/f734bce1693ae9ccfef2072c8a7a2acc6fc4003a) (commit date: 2026-08-14 04:11:19+00:00) # Noteworthy file changes - Stdlib files (1 removed) - Low-signal files (6 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GAQZpieqJXE_tGkFADjL7gYu23s-br0LAAAz Reviewed By: ambv Differential Revision: D116022099 fbshipit-source-id: 6a57dccbc3abfb312ab7ae5228815f08c16ce4b9
1 parent 1da8ecb commit 10a5565

33 files changed

Lines changed: 384 additions & 219 deletions

Doc/library/compression.zstd.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ Compressing and decompressing data in memory
342342
will be set to ``True``.
343343

344344
Attempting to decompress data after the end of a frame will raise a
345-
:exc:`ZstdError`. Any data found after the end of the frame is ignored
345+
:exc:`EOFError`. Any data found after the end of the frame is ignored
346346
and saved in the :attr:`~.unused_data` attribute.
347347

348348
.. attribute:: eof

Doc/library/csv.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ The :mod:`!csv` module defines the following classes:
316316

317317
If several delimiters fit the sample equally well ---
318318
for example if both ``','`` and ``';'`` split every row consistently ---
319-
the delimiters ``','``, ``'\t'``, ``';'``, ``' '`` and ``':'``
320-
are preferred, in this order,
319+
the delimiters listed in the :attr:`~Sniffer.preferred` attribute
320+
are preferred, in that order,
321321
no matter how many times each of them occurs.
322322

323323
.. method:: has_header(sample)
@@ -339,6 +339,15 @@ The :mod:`!csv` module defines the following classes:
339339
This method is a rough heuristic and may produce both false positives and
340340
negatives.
341341

342+
The :class:`Sniffer` class has the following attribute:
343+
344+
.. attribute:: preferred
345+
346+
The list of the delimiters preferred for breaking ties,
347+
in the order of preference.
348+
It can be modified.
349+
Its initial value is ``[',', '\t', ';', ' ', ':']``.
350+
342351
An example for :class:`Sniffer` use::
343352

344353
with open('example.csv', newline='') as csvfile:
@@ -362,6 +371,8 @@ The :mod:`!csv` module defines the following constants:
362371
Instructs :class:`writer` objects to only quote those fields which contain
363372
special characters such as *delimiter*, *quotechar*, ``'\r'``, ``'\n'``
364373
or any of the characters in *lineterminator*.
374+
If *doublequote* is :const:`False` and *escapechar* is set,
375+
the *quotechar* is escaped instead of causing the field to be quoted.
365376

366377

367378
.. data:: QUOTE_NONNUMERIC
@@ -466,6 +477,10 @@ Dialects support the following attributes:
466477
On reading, the *escapechar* removes any special meaning from
467478
the following character. It defaults to :const:`None`, which disables escaping.
468479

480+
.. versionchanged:: 3.10
481+
Previously the *escapechar* itself was not escaped,
482+
which lost it on reading.
483+
469484
.. versionchanged:: 3.11
470485
An empty *escapechar* is not allowed.
471486

Doc/library/curses.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ Linux and the BSD variants of Unix.
3434
Whenever the documentation mentions a *character string* it can be specified
3535
as a Unicode string or a byte string.
3636

37+
.. note::
38+
39+
Whether curses may be used from several threads
40+
depends on the underlying library and how it was built.
41+
In many implementations, including the default build of ncurses,
42+
the screen state is shared and not thread-safe;
43+
since the blocking and refresh methods
44+
(such as :meth:`~window.getch` and :meth:`~window.refresh`)
45+
release the :term:`GIL`,
46+
unsynchronized use from several threads can then crash the interpreter.
47+
Serialize the calls.
48+
3749
.. seealso::
3850

3951
Module :mod:`curses.ascii`

Doc/library/inspect.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ Retrieving source code
714714
.. function:: getfile(object)
715715

716716
Return the name of the (text or binary) file in which an object was defined.
717+
An :exc:`OSError` is raised if the source code cannot be retrieved.
717718
This will fail with a :exc:`TypeError` if the object is a built-in module,
718719
class, or function.
719720

@@ -727,9 +728,10 @@ Retrieving source code
727728
.. function:: getsourcefile(object)
728729

729730
Return the name of the Python source file in which an object was defined
730-
or ``None`` if no way can be identified to get the source. This
731-
will fail with a :exc:`TypeError` if the object is a built-in module, class, or
732-
function.
731+
or ``None`` if no way can be identified to get the source. An :exc:`OSError` is
732+
raised if the source code cannot be retrieved.
733+
This will fail with a :exc:`TypeError` if the object is a built-in module,
734+
class, or function.
733735

734736

735737
.. function:: getsourcelines(object)

Doc/library/os.path.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ the :mod:`glob` module.)
5959
Return a normalized absolutized version of the pathname *path*. On most
6060
platforms, this is equivalent to calling ``normpath(join(os.getcwd(), path))``.
6161

62+
On Windows the path is normalized by the operating system,
63+
therefore the result can differ from ``normpath(join(os.getcwd(), path))``.
64+
A drive-relative path is resolved against the current directory
65+
of the specified drive, and the drive letter is capitalized.
66+
Trailing dots and spaces are stripped.
67+
For example::
68+
69+
>>> os.path.abspath('c:spam')
70+
'C:\\Temp\\spam'
71+
>>> os.path.abspath('c:/temp/spam. . .')
72+
'c:\\temp\\spam'
73+
6274
.. seealso:: :func:`os.path.join` and :func:`os.path.normpath`.
6375

6476
.. versionchanged:: 3.6
@@ -427,6 +439,9 @@ the :mod:`glob` module.)
427439
links encountered in the path (if they are supported by the operating
428440
system). On Windows, this function will also resolve MS-DOS (also called 8.3)
429441
style names such as ``C:\\PROGRA~1`` to ``C:\\Program Files``.
442+
The returned path uses the case reported by the operating system,
443+
which can differ from the case of *path*,
444+
in particular the drive letter is capitalized.
430445

431446
By default, the path is evaluated up to the first component that does not
432447
exist, is a symlink loop, or whose evaluation raises :exc:`OSError`.

Doc/library/site.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,19 @@ Module contents
241241
used in :mod:`sitecustomize` or :mod:`usercustomize` (see above).
242242

243243

244-
.. function:: getsitepackages()
244+
.. function:: getsitepackages(prefixes=None)
245245

246246
Return a list containing all global site-packages directories.
247247

248+
For each directory present in *prefixes* (or :data:`PREFIXES` if *prefixes*
249+
is ``None``), this function will find its site-packages subdirectory
250+
depending on the system environment, and will return a list of full paths.
251+
248252
.. versionadded:: 3.2
249253

254+
.. versionchanged:: 3.3
255+
Added the optional *prefixes* parameter.
256+
250257

251258
.. function:: getuserbase()
252259

Doc/library/stdtypes.rst

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,7 +2585,8 @@ expression support in the :mod:`re` module).
25852585

25862586
Return a list of the words in the string, using *sep* as the delimiter string.
25872587
If *maxsplit* is given, at most *maxsplit* splits are done, the *rightmost*
2588-
ones. If *sep* is not specified or ``None``, any whitespace string is a
2588+
ones. If *sep* is not specified or ``None``, any
2589+
:meth:`whitespace <str.isspace>` string is a
25892590
separator. Except for splitting from the right, :meth:`rsplit` behaves like
25902591
:meth:`split` which is described in detail below.
25912592

@@ -2645,7 +2646,8 @@ expression support in the :mod:`re` module).
26452646
['1', '2', '3<4']
26462647

26472648
If *sep* is not specified or is ``None``, a different splitting algorithm is
2648-
applied: runs of consecutive whitespace are regarded as a single separator,
2649+
applied: runs of consecutive :meth:`whitespace <str.isspace>` are regarded
2650+
as a single separator,
26492651
and the result will contain no empty strings at the start or end if the
26502652
string has leading or trailing whitespace. Consequently, splitting an empty
26512653
string or a string consisting of just whitespace with a ``None`` separator
@@ -3875,7 +3877,8 @@ produce new objects.
38753877
Return a copy of the sequence with specified leading bytes removed. The
38763878
*bytes* argument is a binary sequence specifying the set of byte values to
38773879
be removed. If omitted or ``None``, the *bytes* argument defaults
3878-
to removing ASCII whitespace. The *bytes* argument is not a prefix;
3880+
to removing :meth:`ASCII whitespace <bytes.isspace>`.
3881+
The *bytes* argument is not a prefix;
38793882
rather, all combinations of its values are stripped::
38803883

38813884
>>> b' spacious '.lstrip()
@@ -3919,7 +3922,8 @@ produce new objects.
39193922
Split the binary sequence into subsequences of the same type, using *sep*
39203923
as the delimiter string. If *maxsplit* is given, at most *maxsplit* splits
39213924
are done, the *rightmost* ones. If *sep* is not specified or ``None``,
3922-
any subsequence consisting solely of ASCII whitespace is a separator.
3925+
any subsequence consisting solely of
3926+
:meth:`ASCII whitespace <bytes.isspace>` is a separator.
39233927
Except for splitting from the right, :meth:`rsplit` behaves like
39243928
:meth:`split` which is described in detail below.
39253929

@@ -3930,7 +3934,8 @@ produce new objects.
39303934
Return a copy of the sequence with specified trailing bytes removed. The
39313935
*bytes* argument is a binary sequence specifying the set of byte values to
39323936
be removed. If omitted or ``None``, the *bytes* argument defaults to
3933-
removing ASCII whitespace. The *bytes* argument is not a suffix; rather,
3937+
removing :meth:`ASCII whitespace <bytes.isspace>`.
3938+
The *bytes* argument is not a suffix; rather,
39343939
all combinations of its values are stripped::
39353940

39363941
>>> b' spacious '.rstrip()
@@ -3983,7 +3988,8 @@ produce new objects.
39833988
[b'1', b'2', b'3<4']
39843989

39853990
If *sep* is not specified or is ``None``, a different splitting algorithm
3986-
is applied: runs of consecutive ASCII whitespace are regarded as a single
3991+
is applied: runs of consecutive :meth:`ASCII whitespace <bytes.isspace>`
3992+
are regarded as a single
39873993
separator, and the result will contain no empty strings at the start or
39883994
end if the sequence has leading or trailing whitespace. Consequently,
39893995
splitting an empty sequence or a sequence consisting solely of ASCII
@@ -4006,7 +4012,8 @@ produce new objects.
40064012
Return a copy of the sequence with specified leading and trailing bytes
40074013
removed. The *bytes* argument is a binary sequence specifying the set of
40084014
byte values to be removed. If omitted or ``None``, the *bytes*
4009-
argument defaults to removing ASCII whitespace. The *bytes* argument is
4015+
argument defaults to removing :meth:`ASCII whitespace <bytes.isspace>`.
4016+
The *bytes* argument is
40104017
not a prefix or suffix; rather, all combinations of its values are
40114018
stripped::
40124019

Lib/doctest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,8 @@ def getvalue(self):
291291
return result
292292

293293
def truncate(self, size=None):
294-
self.seek(size)
294+
if size is not None:
295+
self.seek(size)
295296
StringIO.truncate(self)
296297

297298
# Worst-case linear-time ellipsis matching.
@@ -928,7 +929,7 @@ def find(self, obj, name=None, module=None, globs=None, extraglobs=None):
928929
# given object's docstring.
929930
try:
930931
file = inspect.getsourcefile(obj)
931-
except TypeError:
932+
except (TypeError, OSError):
932933
source_lines = None
933934
else:
934935
if not file:

Lib/idlelib/idle_test/test_zzdummy.py

Lines changed: 33 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,38 @@ def __init__(self, root, text):
3838
self.text.undo_block_stop = mock.Mock()
3939

4040

41-
class ZZDummyMixin:
42-
"""Shared tests for ZzDummy with default and user configs."""
41+
class ZZDummyTest(unittest.TestCase):
42+
43+
@classmethod
44+
def setUpClass(cls):
45+
requires('gui')
46+
root = cls.root = Tk()
47+
root.withdraw()
48+
text = cls.text = Text(cls.root)
49+
cls.editor = DummyEditwin(root, text)
50+
zzdummy.idleConf.userCfg = testcfg
51+
52+
@classmethod
53+
def tearDownClass(cls):
54+
zzdummy.idleConf.userCfg = usercfg
55+
del cls.editor, cls.text
56+
cls.root.update_idletasks()
57+
for id in cls.root.tk.call('after', 'info'):
58+
cls.root.after_cancel(id) # Need for EditorWindow.
59+
cls.root.destroy()
60+
del cls.root
61+
62+
def setUp(self):
63+
text = self.text
64+
text.insert('1.0', code_sample)
65+
text.undo_block_start.reset_mock()
66+
text.undo_block_stop.reset_mock()
67+
zz = self.zz = zzdummy.ZzDummy(self.editor)
68+
zzdummy.ZzDummy.ztext = '# ignore #'
69+
70+
def tearDown(self):
71+
self.text.delete('1.0', 'end')
72+
del self.zz
4373

4474
def checklines(self, text, value):
4575
# Verify that there are lines being checked.
@@ -59,8 +89,7 @@ def test_init(self):
5989

6090
def test_reload(self):
6191
self.assertEqual(self.zz.ztext, '# ignore #')
62-
zzdummy.idleConf.userCfg['extensions'].SetOption(
63-
'ZzDummy', 'z-text', 'spam')
92+
testcfg['extensions'].SetOption('ZzDummy', 'z-text', 'spam')
6493
zzdummy.ZzDummy.reload()
6594
self.assertEqual(self.zz.ztext, 'spam')
6695

@@ -119,75 +148,5 @@ def test_roundtrip(self):
119148
self.assertEqual(text.get('1.0', 'end-1c'), code_sample)
120149

121150

122-
class ZZDummyTest(ZZDummyMixin, unittest.TestCase):
123-
124-
@classmethod
125-
def setUpClass(cls):
126-
requires('gui')
127-
root = cls.root = Tk()
128-
root.withdraw()
129-
text = cls.text = Text(cls.root)
130-
cls.editor = DummyEditwin(root, text)
131-
zzdummy.idleConf.userCfg = testcfg
132-
133-
@classmethod
134-
def tearDownClass(cls):
135-
zzdummy.idleConf.userCfg = usercfg
136-
del cls.editor, cls.text
137-
cls.root.update_idletasks()
138-
for id in cls.root.tk.call('after', 'info'):
139-
cls.root.after_cancel(id) # Need for EditorWindow.
140-
cls.root.destroy()
141-
del cls.root
142-
143-
def setUp(self):
144-
text = self.text
145-
text.insert('1.0', code_sample)
146-
text.undo_block_start.reset_mock()
147-
text.undo_block_stop.reset_mock()
148-
zz = self.zz = zzdummy.ZzDummy(self.editor)
149-
zzdummy.ZzDummy.ztext = '# ignore #'
150-
151-
def tearDown(self):
152-
self.text.delete('1.0', 'end')
153-
del self.zz
154-
155-
def test_exists(self):
156-
conf = zzdummy.idleConf
157-
self.assertEqual(
158-
conf.GetSectionList('user', 'extensions'), [])
159-
self.assertEqual(
160-
conf.GetSectionList('default', 'extensions'),
161-
['AutoComplete', 'CodeContext', 'FormatParagraph',
162-
'ParenMatch', 'ZzDummy', 'ZzDummy_cfgBindings',
163-
'ZzDummy_bindings'])
164-
self.assertIn("ZzDummy", conf.GetExtensions(False))
165-
self.assertNotIn("ZzDummy", conf.GetExtensions())
166-
self.assertEqual(
167-
conf.GetExtensionKeys("ZzDummy"), {})
168-
self.assertEqual(
169-
conf.GetExtensionBindings("ZzDummy"),
170-
{'<<z-out>>': ['<Control-Shift-KeyRelease-Delete>']})
171-
172-
def test_exists_user(self):
173-
conf = zzdummy.idleConf
174-
conf.userCfg["extensions"].read_dict({
175-
"ZzDummy": {'enable': 'True'}
176-
})
177-
self.assertEqual(
178-
conf.GetSectionList('user', 'extensions'),
179-
["ZzDummy"])
180-
self.assertIn("ZzDummy", conf.GetExtensions())
181-
self.assertEqual(
182-
conf.GetExtensionKeys("ZzDummy"),
183-
{'<<z-in>>': ['<Control-Shift-KeyRelease-Insert>']})
184-
self.assertEqual(
185-
conf.GetExtensionBindings("ZzDummy"),
186-
{'<<z-in>>': ['<Control-Shift-KeyRelease-Insert>'],
187-
'<<z-out>>': ['<Control-Shift-KeyRelease-Delete>']})
188-
# Restore
189-
conf.userCfg["extensions"].remove_section("ZzDummy")
190-
191-
192151
if __name__ == '__main__':
193152
unittest.main(verbosity=2)

0 commit comments

Comments
 (0)