Skip to content

Commit 2d57d0e

Browse files
generatedunixname1734921407115435meta-codesync[bot]
authored andcommitted
Sync pre-release CPython 3.15 branch from GitHub (2026-06-15)
Summary: Imported python/cpython `3.15.0b2+dev` from upstream rev [`e2c7fa7`](https://www.github.com/python/cpython/commit/e2c7fa7ff65dce05b857a3bbac275894dad967ad) (committed 2026-06-15 22:45:45+00:00). # Commit Info - Base: (`3.15.0b2+dev`) - [`1b457d3`](https://www.github.com/python/cpython/commit/1b457d3bbc528184f373bdcac47f0951052f90b7) (commit date: 2026-06-14 18:37:23+00:00) - Imported: (`3.15.0b2+dev`) - [`e2c7fa7`](https://www.github.com/python/cpython/commit/e2c7fa7ff65dce05b857a3bbac275894dad967ad) (commit date: 2026-06-15 22:45:45+00:00) # Noteworthy file changes - Low-signal files (2 added) (NEWS.d, docs, .github) Complete list of added/removed files: https://www.internalfb.com/intern/everpaste/?color=0&handle=GJOzXyBbrdgGkaoFAC7k4dFRBY4Dbr0LAAAz Differential Revision: D108709671 fbshipit-source-id: eb6426b16896673ed67b829e58f673191aceb1b4
1 parent 709ea3d commit 2d57d0e

14 files changed

Lines changed: 53 additions & 19 deletions

.editorconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
root = true
22

3-
[*.{py,c,cpp,h,js,rst,md,yml,yaml,gram}]
3+
[*.{py,c,cpp,h,js,rst,md,yml,yaml,toml,gram}]
44
trim_trailing_whitespace = true
55
insert_final_newline = true
66
indent_style = space
77

8-
[*.{py,c,cpp,h,gram}]
8+
[*.{py,c,cpp,h,toml,gram}]
99
indent_size = 4
1010

1111
[*.rst]

Lib/site.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ def _exec_imports(self):
505505
# batch. In that case, PEP 829 says the import lines are
506506
# suppressed in favor of the .start's entry points.
507507
for filename, imports in self._importexecs.items():
508+
# Inject 'sitedir' local variable in the current frame for
509+
# compatibility with Python 3.14. Especially, "-nspkg.pth" files
510+
# generated by setuptools use: sys._getframe(1).f_locals['sitedir'].
511+
sitedir = os.path.dirname(filename)
512+
508513
# Given "/path/to/foo.pth", check whether "/path/to/foo.start" was
509514
# registered in this same batch.
510515
name, dot, pth = filename.rpartition(".")

Lib/test/support/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3164,7 +3164,7 @@ def in_systemd_nspawn_sync_suppressed() -> bool:
31643164
with open("/run/systemd/container", "rb") as fp:
31653165
if fp.read().rstrip() != b"systemd-nspawn":
31663166
return False
3167-
except FileNotFoundError:
3167+
except (FileNotFoundError, PermissionError):
31683168
return False
31693169

31703170
# If systemd-nspawn is used, O_SYNC flag will immediately

Lib/test/test_ctypes/test_as_parameter.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
c_short, c_int, c_long, c_longlong,
66
c_byte, c_wchar, c_float, c_double,
77
ArgumentError)
8-
from test.support import import_helper, skip_if_sanitizer
8+
from test.support import import_helper, skip_if_sanitizer, skip_emscripten_stack_overflow
99
_ctypes_test = import_helper.import_module("_ctypes_test")
1010

1111

@@ -193,6 +193,7 @@ class S8I(Structure):
193193
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))
194194

195195
@skip_if_sanitizer('requires deep stack', thread=True)
196+
@skip_emscripten_stack_overflow()
196197
def test_recursive_as_param(self):
197198
class A:
198199
pass

Lib/test/test_ctypes/test_structures.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,16 @@ class X(Structure):
299299
self.assertEqual(s.first, got.first)
300300
self.assertEqual(s.second, got.second)
301301

302+
@unittest.skipIf(support.is_wasm32, "wasm ABI is incompatible with test expectations")
302303
def _test_issue18060(self, Vector):
303304
# Regression tests for gh-62260
304305

306+
# This test passes a struct of two doubles by value to atan2(), whose C
307+
# signature is atan2(double, double), so it only works on platforms
308+
# where the abi of a function that takes a struct with two doubles
309+
# matches the abi of a function that takes two doubles. The wasm32 ABI
310+
# does not satisfy this condition and the test breaks.
311+
305312
# The call to atan2() should succeed if the
306313
# class fields were correctly cloned in the
307314
# subclasses. Otherwise, it will segfault.

Lib/test/test_site.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,20 @@ def test_addsitedir_hidden_file_attribute(self):
233233
self.assertNotIn(site.makepath(pth_file.good_dir_path)[0], sys.path)
234234
self.assertIn(pth_file.base_dir, sys.path)
235235

236+
def test_sitedir_variable(self):
237+
# gh-149671: setuptools use of `-nspkg.pth` files in Python < 3.15.
238+
code = '; '.join((
239+
# Code used by "-nspkg.pth" files generated by setuptools.
240+
"import sys",
241+
"sitedir = sys._getframe(1).f_locals['sitedir']",
242+
"print(sitedir)",
243+
))
244+
pth_dir, pth_fn = self.make_pth(code)
245+
with support.captured_stdout() as stdout:
246+
known_paths = site.addpackage(pth_dir, pth_fn, set())
247+
sitedir = stdout.getvalue().rstrip()
248+
self.assertEqual(sitedir, pth_dir)
249+
236250
# This tests _getuserbase, hence the double underline
237251
# to distinguish from a test for getuserbase
238252
def test__getuserbase(self):
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Restore compatibility with setuptools ``-nspkg.pth`` files in the :mod:`site`
2+
module. Inject ``sitedir`` variable in the frame which executes pth code.
3+
Patch by Victor Stinner.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix tests failing on FreeBSD in test.support's
2+
in_systemd_nspawn_sync_suppressed() due to unreadable /run directory.

Modules/_testinternalcapi/test_cases.c.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2348,7 +2348,7 @@ dummy_func(
23482348
assert(keys->dk_kind == DICT_KEYS_UNICODE);
23492349
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(keys);
23502350
assert(index < DK_SIZE(keys));
2351-
PyObject *res_o = FT_ATOMIC_LOAD_PTR_RELAXED(entries[index].me_value);
2351+
PyObject *res_o = FT_ATOMIC_LOAD_PTR_CONSUME(entries[index].me_value);
23522352
DEOPT_IF(res_o == NULL);
23532353
#if Py_GIL_DISABLED
23542354
int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res);
@@ -2367,7 +2367,7 @@ dummy_func(
23672367
DEOPT_IF(FT_ATOMIC_LOAD_UINT32_RELAXED(keys->dk_version) != version);
23682368
assert(keys->dk_kind == DICT_KEYS_UNICODE);
23692369
PyDictUnicodeEntry *entries = DK_UNICODE_ENTRIES(keys);
2370-
PyObject *res_o = FT_ATOMIC_LOAD_PTR_RELAXED(entries[index].me_value);
2370+
PyObject *res_o = FT_ATOMIC_LOAD_PTR_CONSUME(entries[index].me_value);
23712371
DEOPT_IF(res_o == NULL);
23722372
#if Py_GIL_DISABLED
23732373
int increfed = _Py_TryIncrefCompareStackRef(&entries[index].me_value, res_o, &res);
@@ -2957,7 +2957,7 @@ dummy_func(
29572957
assert(keys->dk_kind == DICT_KEYS_UNICODE);
29582958
assert(index < FT_ATOMIC_LOAD_SSIZE_RELAXED(keys->dk_nentries));
29592959
PyDictUnicodeEntry *ep = DK_UNICODE_ENTRIES(keys) + index;
2960-
PyObject *attr_o = FT_ATOMIC_LOAD_PTR_RELAXED(ep->me_value);
2960+
PyObject *attr_o = FT_ATOMIC_LOAD_PTR_CONSUME(ep->me_value);
29612961
EXIT_IF(attr_o == NULL);
29622962
#ifdef Py_GIL_DISABLED
29632963
int increfed = _Py_TryIncrefCompareStackRef(&ep->me_value, attr_o, &attr);

0 commit comments

Comments
 (0)