From b95623ede39c3d35860ccb67f92c0521aaec44c1 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Wed, 10 Apr 2024 11:22:30 +0200 Subject: [PATCH] Update to Python 3.13.0a6 Patch 00371 was removed as it no longer applies after https://github.com/python/cpython/commit/33da0e844c922b3dcded75fbb9b7be67cb013a17 We need to monitor the freeipa situation and rework the patch entirely in case it is still needed. See also https://bugzilla.redhat.com/2133853 --- 00251-change-user-install-location.patch | 18 +-- ...or-the-main-thread-gh-28549-gh-28589.patch | 109 ------------------ ...move-all-internal-usage-of-libpython.patch | 37 ------ ...st-wheeldata-when-it-s-actually-used.patch | 28 +++++ python3.13.spec | 37 +++--- sources | 4 +- 6 files changed, 54 insertions(+), 179 deletions(-) delete mode 100644 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch delete mode 100644 00424-gh-116745-remove-all-internal-usage-of-libpython.patch create mode 100644 00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch diff --git a/00251-change-user-install-location.patch b/00251-change-user-install-location.patch index a816ed2..823059e 100644 --- a/00251-change-user-install-location.patch +++ b/00251-change-user-install-location.patch @@ -30,7 +30,7 @@ Co-authored-by: Lumír Balhar 3 files changed, 72 insertions(+), 4 deletions(-) diff --git a/Lib/site.py b/Lib/site.py -index 2aee63e24c..00855f437c 100644 +index 162bbec4f8..40c5981e03 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -395,8 +395,15 @@ def getsitepackages(prefixes=None): @@ -51,10 +51,10 @@ index 2aee63e24c..00855f437c 100644 if os.path.isdir(sitedir): addsitedir(sitedir, known_paths) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py -index 07ab27c7fb..d3e22762bf 100644 +index 70bdecf213..5cd75a3b96 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py -@@ -104,6 +104,12 @@ +@@ -106,6 +106,12 @@ else: _INSTALL_SCHEMES['venv'] = _INSTALL_SCHEMES['posix_venv'] @@ -67,7 +67,7 @@ index 07ab27c7fb..d3e22762bf 100644 def _get_implementation(): return 'Python' -@@ -165,6 +171,19 @@ def joinuser(*args): +@@ -167,6 +173,19 @@ def joinuser(*args): }, } @@ -87,7 +87,7 @@ index 07ab27c7fb..d3e22762bf 100644 _SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include', 'scripts', 'data') -@@ -259,11 +278,40 @@ def _extend_dict(target_dict, other_dict): +@@ -261,11 +280,40 @@ def _extend_dict(target_dict, other_dict): target_dict[key] = value @@ -130,10 +130,10 @@ index 07ab27c7fb..d3e22762bf 100644 # On Windows we want to substitute 'lib' for schemes rather # than the native value (without modifying vars, in case it diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py -index c8315bbc8b..5a18592d8f 100644 +index 61c6a5a425..fd5fbe17ad 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py -@@ -117,8 +117,19 @@ def test_get_path(self): +@@ -121,8 +121,19 @@ def test_get_path(self): for scheme in _INSTALL_SCHEMES: for name in _INSTALL_SCHEMES[scheme]: expected = _INSTALL_SCHEMES[scheme][name].format(**config_vars) @@ -154,7 +154,7 @@ index c8315bbc8b..5a18592d8f 100644 os.path.normpath(expected), ) -@@ -351,7 +362,7 @@ def test_get_config_h_filename(self): +@@ -357,7 +368,7 @@ def test_get_config_h_filename(self): self.assertTrue(os.path.isfile(config_h), config_h) def test_get_scheme_names(self): @@ -163,7 +163,7 @@ index c8315bbc8b..5a18592d8f 100644 if HAS_USER_BASE: wanted.extend(['nt_user', 'osx_framework_user', 'posix_user']) self.assertEqual(get_scheme_names(), tuple(sorted(wanted))) -@@ -363,6 +374,8 @@ def test_symlink(self): # Issue 7880 +@@ -369,6 +380,8 @@ def test_symlink(self): # Issue 7880 cmd = "-c", "import sysconfig; print(sysconfig.get_platform())" self.assertEqual(py.call_real(*cmd), py.call_link(*cmd)) diff --git a/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch b/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch deleted file mode 100644 index 1b33c31..0000000 --- a/00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= -Date: Tue, 25 Oct 2022 12:02:33 +0200 -Subject: [PATCH] 00371: Revert "bpo-1596321: Fix threading._shutdown() for the - main thread (GH-28549) (GH-28589)" - -This reverts commit 38c67738c64304928c68d5c2bd78bbb01d979b94. It -introduced regression causing FreeIPA's tests to fail. - -For more info see: -https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31 -https://github.com/GrahamDumpleton/mod_wsgi/issues/730 ---- - Lib/test/test_threading.py | 33 --------------------------------- - Lib/threading.py | 31 +++++++++++-------------------- - 2 files changed, 11 insertions(+), 53 deletions(-) - -diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py -index 3b5c37c948..ad070237d0 100644 ---- a/Lib/test/test_threading.py -+++ b/Lib/test/test_threading.py -@@ -1169,39 +1169,6 @@ def noop(): pass - threading.Thread(target=noop).start() - # Thread.join() is not called - -- def test_import_from_another_thread(self): -- # bpo-1596321: If the threading module is first import from a thread -- # different than the main thread, threading._shutdown() must handle -- # this case without logging an error at Python exit. -- code = textwrap.dedent(''' -- import _thread -- import sys -- -- event = _thread.allocate_lock() -- event.acquire() -- -- def import_threading(): -- import threading -- event.release() -- -- if 'threading' in sys.modules: -- raise Exception('threading is already imported') -- -- _thread.start_new_thread(import_threading, ()) -- -- # wait until the threading module is imported -- event.acquire() -- event.release() -- -- if 'threading' not in sys.modules: -- raise Exception('threading is not imported') -- -- # don't wait until the thread completes -- ''') -- rc, out, err = assert_python_ok("-c", code) -- self.assertEqual(out, b'') -- self.assertEqual(err, b'') -- - def test_start_new_thread_at_exit(self): - code = """if 1: - import atexit -diff --git a/Lib/threading.py b/Lib/threading.py -index ec89550d6b..46b222a6a3 100644 ---- a/Lib/threading.py -+++ b/Lib/threading.py -@@ -1642,32 +1642,23 @@ def _shutdown(): - - global _SHUTTING_DOWN - _SHUTTING_DOWN = True -+ # Main thread -+ tlock = _main_thread._tstate_lock -+ # The main thread isn't finished yet, so its thread state lock can't have -+ # been released. -+ assert tlock is not None -+ if tlock.locked(): -+ # It should have been released already by -+ # _PyInterpreterState_SetNotRunningMain(), but there may be -+ # embedders that aren't calling that yet. -+ tlock.release() -+ _main_thread._stop() - - # Call registered threading atexit functions before threads are joined. - # Order is reversed, similar to atexit. - for atexit_call in reversed(_threading_atexits): - atexit_call() - -- # Main thread -- if _main_thread.ident == get_ident(): -- tlock = _main_thread._tstate_lock -- # The main thread isn't finished yet, so its thread state lock can't -- # have been released. -- assert tlock is not None -- if tlock.locked(): -- # It should have been released already by -- # _PyInterpreterState_SetNotRunningMain(), but there may be -- # embedders that aren't calling that yet. -- tlock.release() -- _main_thread._stop() -- else: -- # bpo-1596321: _shutdown() must be called in the main thread. -- # If the threading module was not imported by the main thread, -- # _main_thread is the thread which imported the threading module. -- # In this case, ignore _main_thread, similar behavior than for threads -- # spawned by C libraries or using _thread.start_new_thread(). -- pass -- - # Join all non-deamon threads - while True: - with _shutdown_locks_lock: diff --git a/00424-gh-116745-remove-all-internal-usage-of-libpython.patch b/00424-gh-116745-remove-all-internal-usage-of-libpython.patch deleted file mode 100644 index 4c6f8fe..0000000 --- a/00424-gh-116745-remove-all-internal-usage-of-libpython.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Thomas A Caswell -Date: Wed, 13 Mar 2024 14:05:35 -0400 -Subject: [PATCH] 00424: gh-116745: remove all internal usage of @LIBPYTHON@ - -Follow on to https://github.com/python/cpython/pull/115780 . - -Without this change numpy's build is broken. ---- - Misc/python-config.sh.in | 2 +- - Misc/python.pc.in | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Misc/python-config.sh.in b/Misc/python-config.sh.in -index eb02223ddc..c3c0b34fc1 100644 ---- a/Misc/python-config.sh.in -+++ b/Misc/python-config.sh.in -@@ -46,7 +46,7 @@ LIBM="@LIBM@" - LIBC="@LIBC@" - SYSLIBS="$LIBM $LIBC" - ABIFLAGS="@ABIFLAGS@" --LIBS="@LIBPYTHON@ @LIBS@ $SYSLIBS" -+LIBS="@MODULE_LDFLAGS@ @LIBS@ $SYSLIBS" - LIBS_EMBED="-lpython${VERSION}${ABIFLAGS} @LIBS@ $SYSLIBS" - BASECFLAGS="@BASECFLAGS@" - LDLIBRARY="@LDLIBRARY@" -diff --git a/Misc/python.pc.in b/Misc/python.pc.in -index 027dba3858..c2c740e82b 100644 ---- a/Misc/python.pc.in -+++ b/Misc/python.pc.in -@@ -9,5 +9,5 @@ Description: Build a C extension for Python - Requires: - Version: @VERSION@ - Libs.private: @LIBS@ --Libs: -L${libdir} @LIBPYTHON@ -+Libs: -L${libdir} @MODULE_LDFLAGS@ - Cflags: -I${includedir}/python@VERSION@@ABIFLAGS@ diff --git a/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch b/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch new file mode 100644 index 0000000..1946abb --- /dev/null +++ b/00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch @@ -0,0 +1,28 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Karolina Surma +Date: Wed, 10 Apr 2024 15:35:04 +0200 +Subject: [PATCH] 00425: Only check for 'test/wheeldata' when it's actually + used + +We build Python in Fedora 39+ with option `--with-wheel-pkg-dir` +pointing to a custom wheel directory and delete the contents of +upstream's `test/wheeldata`. Don't include the directory in the test set +if the wheels are used from a different location. +--- + Lib/test/test_tools/test_makefile.py | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/Lib/test/test_tools/test_makefile.py b/Lib/test/test_tools/test_makefile.py +index 29f5c28e33..b0dc56c714 100644 +--- a/Lib/test/test_tools/test_makefile.py ++++ b/Lib/test/test_tools/test_makefile.py +@@ -67,6 +67,9 @@ def test_makefile_test_folders(self): + ) + used.append(relpath) + ++ if sysconfig.get_config_var('WHEEL_PKG_DIR'): ++ test_dirs.remove('test/wheeldata') ++ + # Check that there are no extra entries: + unique_test_dirs = set(test_dirs) + self.assertSetEqual(unique_test_dirs, set(used)) diff --git a/python3.13.spec b/python3.13.spec index f9b750e..ca73288 100644 --- a/python3.13.spec +++ b/python3.13.spec @@ -14,10 +14,10 @@ URL: https://www.python.org/ # WARNING When rebasing to a new Python version, # remember to update the python3-docs package as well %global general_version %{pybasever}.0 -%global prerel a5 +%global prerel a6 %global upstream_version %{general_version}%{?prerel} Version: %{general_version}%{?prerel:~%{prerel}} -Release: 2%{?dist} +Release: 1%{?dist} License: Python-2.0.1 @@ -75,7 +75,7 @@ License: Python-2.0.1 # $ tar -tf Python-%%{upstream_version}.tar.xz | grep whl %global pip_version 24.0 %global setuptools_version 67.6.1 -%global wheel_version 0.40.0 +%global wheel_version 0.43.0 # All of those also include a list of indirect bundled libs: # pip # $ %%{_rpmconfigdir}/pythonbundles.py <(unzip -p Lib/ensurepip/_bundled/pip-*.whl pip/_vendor/vendor.txt) @@ -126,7 +126,7 @@ Provides: bundled(python3dist(zipp)) = 3.7 # wheel # $ %%{_rpmconfigdir}/pythonbundles.py <(unzip -p Lib/test/wheeldata/wheel-*.whl wheel/vendored/vendor.txt) %global wheel_bundled_provides %{expand: -Provides: bundled(python3dist(packaging)) = 23 +Provides: bundled(python3dist(packaging)) = 24 } # Expensive optimizations (mainly, profile-guided optimizations) @@ -142,7 +142,7 @@ Provides: bundled(python3dist(packaging)) = 23 # Extra build without GIL, the freethreading PEP 703 provisional way # (the -freethreading subpackage) # support for s390x is pending investigation in -# https://github.com/python/cpython/issues/114331 +# https://github.com/python/cpython/issues/117755 %ifnarch s390x %bcond_without freethreading_build %else @@ -374,24 +374,14 @@ Source11: idle3.appdata.xml # pypa/distutils integration: https://github.com/pypa/distutils/pull/70 Patch251: 00251-change-user-install-location.patch -# 00371 # 16d2d6be400cb52c0f50fa27c0e08ae63d1d3add -# Revert "bpo-1596321: Fix threading._shutdown() for the main thread (GH-28549) (GH-28589)" +# 00425 # a563ac3076a00f0f48b3f94ff63d91d37cb4f1e9 +# Only check for 'test/wheeldata' when it's actually used # -# This reverts commit 38c67738c64304928c68d5c2bd78bbb01d979b94. It -# introduced regression causing FreeIPA's tests to fail. -# -# For more info see: -# https://bodhi.fedoraproject.org/updates/FEDORA-2021-e152ce5f31 -# https://github.com/GrahamDumpleton/mod_wsgi/issues/730 -Patch371: 00371-revert-bpo-1596321-fix-threading-_shutdown-for-the-main-thread-gh-28549-gh-28589.patch - -# 00424 # 767f9ca0f729a52808648bca8786fe046c25a016 -# gh-116745: remove all internal usage of @LIBPYTHON@ -# -# Follow on to https://github.com/python/cpython/pull/115780 . -# -# Without this change numpy's build is broken. -Patch424: 00424-gh-116745-remove-all-internal-usage-of-libpython.patch +# We build Python in Fedora 39+ with option `--with-wheel-pkg-dir` +# pointing to a custom wheel directory and delete the contents of +# upstream's `test/wheeldata`. Don't include the directory in the test set +# if the wheels are used from a different location. +Patch425: 00425-only-check-for-test-wheeldata-when-it-s-actually-used.patch # (New patches go here ^^^) # @@ -1680,6 +1670,9 @@ CheckPython freethreading # ====================================================== %changelog +* Wed Apr 10 2024 Karolina Surma - 3.13.0~a6-1 +- Update to Python 3.13.0a6 + * Wed Mar 13 2024 Python Maint - 3.13.0~a5-2 - Move all test modules to the python3.13-test package, namely: - __phello__ diff --git a/sources b/sources index 261b5bb..530c12a 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -SHA512 (Python-3.13.0a5.tar.xz) = 7238d6792ac35f4cf9c701f7a69ed37de13efe0ba676f26a9b01a15ded1f8f070be295be6fc70b29153e9f2216224438d46500570b5d64641347cf2ccc66b556 -SHA512 (Python-3.13.0a5.tar.xz.asc) = 9cb4235afcde912904a2c3a728d83db45947cbda5ae1efae742f6045d1744008fefe67ed4b667f58194d81b2f341f3718841eb06ffad9a2f2fb5357cb1a373f4 +SHA512 (Python-3.13.0a6.tar.xz) = 6e999c718cdfede4abc52297aae7160a2864424e8f49a47321fa822d40c331a3d061a0982e355351a0c4bea40e9b1ec3832d76a7f4b6b3986b62fca2757f0ca1 +SHA512 (Python-3.13.0a6.tar.xz.asc) = 1ec2abe8198a5fbd98490274bed7e84b48fcfc6ff25fcb474455d9f33b62673cfb7cf4939b304684aed005975d166143cb644b9a3e484d25de3dacb869de0131