From 7f3d09b6e8018c3710dfde9f71c63d47a047beb1 Mon Sep 17 00:00:00 2001 From: Arcadiy Ivanov Date: Wed, 26 Aug 2026 16:45:52 -0400 Subject: [PATCH 1/2] gh-156404: Restore the 'fullname' variable for .pth import lines (#156406) PEP 829 moved .pth handling from site.addpackage() into StartupState._exec_imports(), and the local holding the path of the .pth file being processed was renamed from 'fullname' to 'filename'. Import lines in .pth files generated before Python 3.15 read that local, so they now fail with NameError on every interpreter startup. Inject 'fullname' into the frame which executes pth code, next to the 'sitedir' shim added for gh-149671. Reported downstream as https://github.com/karellen/wheel-axle/issues/38 Co-authored-by: Barry Warsaw --- Lib/site.py | 6 ++++++ Lib/test/test_site.py | 17 +++++++++++++++++ ...26-08-26-08-20-07.gh-issue-156404.2gP33I.rst | 3 +++ 3 files changed, 26 insertions(+) create mode 100644 Misc/NEWS.d/next/Library/2026-08-26-08-20-07.gh-issue-156404.2gP33I.rst diff --git a/Lib/site.py b/Lib/site.py index 873c562d890a3bb..294a4d6f641c39d 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -510,6 +510,12 @@ def _exec_imports(self): # generated by setuptools use: sys._getframe(1).f_locals['sitedir']. sitedir = os.path.dirname(filename) + # Inject 'fullname' local variable in the current frame for + # compatibility with Python 3.14, where the path of the ".pth" + # file being processed was available to import lines under that + # name. + fullname = filename + # Given "/path/to/foo.pth", check whether "/path/to/foo.start" was # registered in this same batch. name, dot, pth = filename.rpartition(".") diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py index bcb51ed7d8476a8..fc5e6369eacaada 100644 --- a/Lib/test/test_site.py +++ b/Lib/test/test_site.py @@ -247,6 +247,23 @@ def test_sitedir_variable(self): sitedir = stdout.getvalue().rstrip() self.assertEqual(sitedir, pth_dir) + def test_fullname_variable(self): + # gh-156404: ".pth" files generated before Python 3.15 read the path + # of the file being processed from the frame executing the import + # line, under the name "fullname". For example, "wheel-axle" + # generates: "import wheel_axle.runtime; + # wheel_axle.runtime.finalize(fullname);" + code = '; '.join(( + "import sys", + "print(fullname)", + "print(filename)", + )) + pth_dir, pth_fn = self.make_pth(code) + with support.captured_stdout() as stdout: + site.addpackage(pth_dir, pth_fn, set()) + expected = os.path.join(pth_dir, pth_fn) + self.assertEqual(stdout.getvalue().splitlines(), [expected, expected]) + # This tests _getuserbase, hence the double underline # to distinguish from a test for getuserbase def test__getuserbase(self): diff --git a/Misc/NEWS.d/next/Library/2026-08-26-08-20-07.gh-issue-156404.2gP33I.rst b/Misc/NEWS.d/next/Library/2026-08-26-08-20-07.gh-issue-156404.2gP33I.rst new file mode 100644 index 000000000000000..475d09c764aa3b4 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-08-26-08-20-07.gh-issue-156404.2gP33I.rst @@ -0,0 +1,3 @@ +Restore compatibility with :file:`.pth` files generated before Python 3.15 in +the :mod:`site` module. Inject the ``fullname`` variable in the frame which +executes pth code. From fe3a26f43fad1d6eed20172d7f63ee2931ae2ce1 Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Wed, 26 Aug 2026 16:50:41 -0500 Subject: [PATCH 2/2] gh-156369: Bump OpenSSL versions for iOS and Android (#156432) --- .../next/Build/2026-08-26-16-10-15.gh-issue-156369.55jGEj.rst | 1 + Platforms/Android/__main__.py | 2 +- Platforms/Apple/__main__.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2026-08-26-16-10-15.gh-issue-156369.55jGEj.rst diff --git a/Misc/NEWS.d/next/Build/2026-08-26-16-10-15.gh-issue-156369.55jGEj.rst b/Misc/NEWS.d/next/Build/2026-08-26-16-10-15.gh-issue-156369.55jGEj.rst new file mode 100644 index 000000000000000..22c0bb4514f98d3 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2026-08-26-16-10-15.gh-issue-156369.55jGEj.rst @@ -0,0 +1 @@ +Update Android and iOS build scripts to use OpenSSL 3.5.8. diff --git a/Platforms/Android/__main__.py b/Platforms/Android/__main__.py index 22123ef5e7fbaae..e153bc86811be63 100755 --- a/Platforms/Android/__main__.py +++ b/Platforms/Android/__main__.py @@ -224,7 +224,7 @@ def unpack_deps(host, prefix_dir, cache_dir): for name_ver in [ "bzip2-1.0.8-3", "libffi-3.4.4-3", - "openssl-3.5.7-0", + "openssl-3.5.8-0", "sqlite-3.53.4-0", "xz-5.4.6-1", "zstd-1.5.7-2" diff --git a/Platforms/Apple/__main__.py b/Platforms/Apple/__main__.py index b294d2720a80dfe..8be0d8719f5b1b5 100644 --- a/Platforms/Apple/__main__.py +++ b/Platforms/Apple/__main__.py @@ -328,7 +328,7 @@ def unpack_deps( for name_ver in [ "BZip2-1.0.8-2", "libFFI-3.4.7-2", - "OpenSSL-3.5.7-1", + "OpenSSL-3.5.8-1", "XZ-5.6.4-2", "mpdecimal-4.0.0-2", "zstd-1.5.7-1",