mercurial fails to build with Python 3.14.0b1. + make install-doc DESTDIR=/builddir/build/BUILD/mercurial-7.0.2-build/BUILDROOT MANDIR=/usr/share/man make -C doc PREFIX="/usr/local" install make[1]: Entering directory '/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/doc' python3 gendoc.py commandlist > commandlist.txt.tmp Traceback (most recent call last): File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/doc/gendoc.py", line 30, in <module> File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 54, in exec_module File "<frozen importlib.util>", line 260, in exec_module File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 52, in exec_module File "/usr/lib64/python3.14/threading.py", line 6, in <module> File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 54, in exec_module File "<frozen importlib.util>", line 270, in exec_module AttributeError: partially initialized module 'threading' from '/usr/lib64/python3.14/threading.py' has no attribute 'RLock' (most likely due to a circular import) python3 gendoc.py "hg-ssh.8" > hg-ssh.8.txt.tmp Traceback (most recent call last): File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/doc/gendoc.py", line 30, in <module> File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 54, in exec_module File "<frozen importlib.util>", line 260, in exec_module File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 52, in exec_module File "/usr/lib64/python3.14/threading.py", line 6, in <module> File "<frozen importlib._bootstrap>", line 1371, in _find_and_load File "<frozen importlib._bootstrap>", line 1342, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 938, in _load_unlocked File "/builddir/build/BUILD/mercurial-7.0.2-build/mercurial-7.0.2/hgdemandimport/demandimportpy3.py", line 54, in exec_module File "<frozen importlib.util>", line 270, in exec_module AttributeError: partially initialized module 'threading' from '/usr/lib64/python3.14/threading.py' has no attribute 'RLock' (most likely due to a circular import) make[1]: *** [Makefile:174: hg-ssh.8.txt] Error 1 https://docs.python.org/3.14/whatsnew/3.14.html For the build logs, see: https://copr-be.cloud.fedoraproject.org/results/@python/python3.14-b1/fedora-rawhide-x86_64/09024567-mercurial/ For all our attempts to build mercurial with Python 3.14, see: https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/package/mercurial/ Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.14: https://copr.fedorainfracloud.org/coprs/g/python/python3.14-b1/ Let us know here if you have any questions. Python 3.14 is planned to be included in Fedora 43. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.14. A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon. We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.
This very much reminds me of a problem that we saw earlier (bz2299346). Back then, it was fixed by a patch added in https://src.fedoraproject.org/rpms/mercurial/c/f1186a25db41b5bde9bdd37eb2fee05466bf1b0e?branch=389eb5b7d2e8459fe6f91a12fc133c310822f0f4 and later removed in https://src.fedoraproject.org/rpms/mercurial/c/9ee6346e8f42002676d4c943a0775ed4040189ff?branch=rawhide as upstreamed.
Indeed, that patch was upstreamed, and the code after fedpkg prep is: IGNORES = { ... # threading is locally imported by importlib.util.LazyLoader.exec_module '_weakrefset', 'warnings', 'threading', 'collections.abc', } https://github.com/python/cpython/commit/d687900f98114bb5910daad9553ae381d7daf94b added a new import to threading, called _contextvars. Perhpas adding that one will fix this?
This patch works: --- a/hgdemandimport/__init__.py +++ b/hgdemandimport/__init__.py @@ -60,6 +60,7 @@ IGNORES = { 'setuptools', '_distutils_hack.override', # threading is locally imported by importlib.util.LazyLoader.exec_module + '_contextvars', '_weakrefset', 'warnings', 'threading', I will try to figure out a way to send an upstream merge request.
https://src.fedoraproject.org/rpms/mercurial/pull-request/23