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/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/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. 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",