Skip to content

Commit 47f0f5d

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Import CPython 3.14.7+ stable branch (2026-08-24)
Summary: Imported python/cpython `3.14.7+` from upstream rev [`7267c9b`](https://www.github.com/python/cpython/commit/7267c9b8f4973bf5be785ebf3ddb9624ed5d4446) (committed 2026-08-24 21:11:08+00:00). # Commit Info - Base: (`3.14.7+`) - [`0bafc36`](https://www.github.com/python/cpython/commit/0bafc3649fa5b3936ea3029265309b724749eb93) (commit date: 2026-08-24 00:20:06+00:00) - Imported: (`3.14.7+`) - [`7267c9b`](https://www.github.com/python/cpython/commit/7267c9b8f4973bf5be785ebf3ddb9624ed5d4446) (commit date: 2026-08-24 21:11:08+00:00) # Noteworthy file changes - Low-signal files (1 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GOQETyf6HVVsnZsFABnABQsXyAxgbr0LAAAz Reviewed By: yoney, itamaro Differential Revision: D117341290 fbshipit-source-id: 31d8f9bbcdbc07aa60abe983c1a7242538b5b394
1 parent 0db7d79 commit 47f0f5d

8 files changed

Lines changed: 57 additions & 13 deletions

File tree

Doc/library/tempfile.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,11 @@ The module defines the following user-callable items:
321321

322322
#. A platform-specific location:
323323

324-
* On Windows, the directories :file:`C:\\TEMP`, :file:`C:\\TMP`,
325-
:file:`\\TEMP`, and :file:`\\TMP`, in that order.
324+
* On Windows, the directories
325+
:file:`%USERPROFILE%\\AppData\\Local\\Temp`,
326+
:file:`%SYSTEMROOT%\\Temp`, :file:`C:\\TEMP`,
327+
:file:`C:\\TMP`, :file:`\\TEMP`, and
328+
:file:`\\TMP`, in that order.
326329

327330
* On all other platforms, the directories :file:`/tmp`, :file:`/var/tmp`, and
328331
:file:`/usr/tmp`, in that order.

Lib/idlelib/idle_test/template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def tearDownClass(cls):
2121
cls.root.destroy()
2222
del cls.root
2323

24+
@unittest.skip('Dummy test')
2425
def test_init(self):
2526
self.assertTrue(True)
2627

Lib/idlelib/idle_test/test_autocomplete.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,14 @@ def test_fetch_completions(self):
230230
# For file completion, a large list containing all files in the path,
231231
# and a small list containing files that do not start with '.'.
232232
acp = self.autocomplete
233-
small, large = acp.fetch_completions(
234-
'', ac.ATTRS)
235-
if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
236-
self.assertNotIn('AutoComplete', small) # See issue 36405.
237233

238-
# Test attributes
239-
s, b = acp.fetch_completions('', ac.ATTRS)
240-
self.assertLess(len(small), len(large))
241-
self.assertTrue(all(filter(lambda x: x.startswith('_'), s)))
242-
self.assertTrue(any(filter(lambda x: x.startswith('_'), b)))
234+
# Test current module (what='') attributes.
235+
small, large = acp.fetch_completions('', ac.ATTRS)
236+
if hasattr(__main__, '__file__') and __main__.__file__ != ac.__file__:
237+
self.assertNotIn('AutoComplete', small) # See gh-80586.
238+
self.assertLess(len(small), len(large)) # Not equal
239+
self.assertFalse(any(a[:1] == '_' for a in small))
240+
self.assertTrue(any(a[:1] == '_' for a in large))
243241

244242
# Test smalll should respect to __all__.
245243
with patch.dict('__main__.__dict__', {'__all__': ['a', 'b']}):

Lib/idlelib/idle_test/test_configdialog.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def tearDownModule():
5050
root = dialog = None
5151

5252

53+
@unittest.skip('Empty tests')
5354
class ConfigDialogTest(unittest.TestCase):
5455

5556
def test_deactivate_current_config(self):

Lib/idlelib/idle_test/test_editor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def test_searcher(self):
211211
self.assertEqual(actual_pair, expected_pair)
212212

213213

214+
@unittest.skip('Empty test')
214215
class RMenuTest(unittest.TestCase):
215216

216217
@classmethod

Lib/test/test_cmd_line.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,24 @@ def test_import_time(self):
12251225
assert_python_failure('-X', 'importtime=-1', '-c', code)
12261226
assert_python_failure('-X', 'importtime=3', '-c', code)
12271227

1228+
def test_import_time_unencodable_module_name(self):
1229+
code = textwrap.dedent("""
1230+
import sys, types
1231+
name = 'mod\\ud800'
1232+
sys.modules[name] = types.ModuleType(name)
1233+
__import__(name)
1234+
try:
1235+
__import__('nonexistent\\ud800')
1236+
except ModuleNotFoundError:
1237+
pass
1238+
""")
1239+
res = assert_python_ok('-X', 'importtime=2', '-c', code)
1240+
res_err = res.err.decode('utf-8')
1241+
self.assertRegex(res_err,
1242+
r'import time: cached\s* \| cached\s* \| mod\\ud800')
1243+
self.assertRegex(res_err,
1244+
r'import time: \s*\d+ \| \s*\d+ \| \s*nonexistent\\ud800')
1245+
12281246
def res2int(self, res):
12291247
out = res.out.strip().decode("utf-8")
12301248
return tuple(int(i) for i in out.split())
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix a crash when importing a module whose name contains characters that
2+
cannot be encoded to UTF-8 (such as lone surrogates) while :option:`-X
3+
importtime <-X>` is enabled.

Python/import.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,19 @@ import_get_module(PyThreadState *tstate, PyObject *name)
259259
return m;
260260
}
261261

262+
static PyObject *
263+
get_importtime_name(PyObject *name)
264+
{
265+
PyObject *exc = PyErr_GetRaisedException();
266+
PyObject *encoded = PyUnicode_AsEncodedString(name, "utf-8",
267+
"backslashreplace");
268+
if (encoded == NULL) {
269+
PyErr_Clear();
270+
}
271+
PyErr_SetRaisedException(exc);
272+
return encoded;
273+
}
274+
262275
static int
263276
import_ensure_initialized(PyInterpreterState *interp, PyObject *mod, PyObject *name)
264277
{
@@ -296,8 +309,11 @@ import_ensure_initialized(PyInterpreterState *interp, PyObject *mod, PyObject *n
296309
if (_PyInterpreterState_GetConfig(interp)->import_time == 2) {
297310
_IMPORT_TIME_HEADER(interp);
298311
#define import_level FIND_AND_LOAD(interp).import_level
312+
PyObject *encoded_name = get_importtime_name(name);
299313
fprintf(stderr, "import time: cached | cached | %*s\n",
300-
import_level*2, PyUnicode_AsUTF8(name));
314+
import_level*2,
315+
encoded_name != NULL ? PyBytes_AS_STRING(encoded_name) : "?");
316+
Py_XDECREF(encoded_name);
301317
#undef import_level
302318
}
303319

@@ -3880,10 +3896,13 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name)
38803896
PyTime_t cum = t2 - t1;
38813897

38823898
import_level--;
3899+
PyObject *encoded_name = get_importtime_name(abs_name);
38833900
fprintf(stderr, "import time: %9ld | %10ld | %*s%s\n",
38843901
(long)_PyTime_AsMicroseconds(cum - accumulated, _PyTime_ROUND_CEILING),
38853902
(long)_PyTime_AsMicroseconds(cum, _PyTime_ROUND_CEILING),
3886-
import_level*2, "", PyUnicode_AsUTF8(abs_name));
3903+
import_level*2, "",
3904+
encoded_name != NULL ? PyBytes_AS_STRING(encoded_name) : "?");
3905+
Py_XDECREF(encoded_name);
38873906

38883907
accumulated = accumulated_copy + cum;
38893908
}

0 commit comments

Comments
 (0)