Bug 2479738 - mercurial fails to build with Python 3.15: ImportError: cannot import name 'RE_DATETIME' from 'tomllib._re' (/usr/lib64/python3.15/tomllib/_re.py)
Summary: mercurial fails to build with Python 3.15: ImportError: cannot import name 'R...
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: mercurial
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Mads Kiilerich
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2026-05-19 07:21 UTC by Karolina Surma
Modified: 2026-05-26 08:06 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2026-05-19 07:21:05 UTC
mercurial fails to build with Python 3.15.0b1.

+ make install-doc DESTDIR=/builddir/build/BUILD/mercurial-7.2.1-build/BUILDROOT MANDIR=/usr/share/man
make -C doc  PREFIX="/usr/local"  install
make[1]: Entering directory '/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/doc'
python3 gendoc.py  commandlist > commandlist.txt.tmp
Traceback (most recent call last):
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 13, in <module>
    from ._re import (
ImportError: deferred import of 'tomllib._re.RE_DATETIME' raised an exception during resolution

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/doc/gendoc.py", line 48, in <module>
    initialization.init()
    ^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/initialization.py", line 67, in <module>
    admin_chainsaw.init()
    ^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/admin/chainsaw.py", line 46, in <module>
    command = registrar.command(tables.command_table)
              ^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/registrar.py", line 22, in <module>
    configitem = configitems.getitemregister
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 215, in <module>
    import_configitems_from_file()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 184, in import_configitems_from_file
    as_toml = read_configitems_file()
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 155, in read_configitems_file
    return tomllib.load(fp)
           ~~~~~~~~~~~~^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 148, in load
    return loads(s, parse_float=parse_float)
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 189, in loads
    pos = key_value_rule(src, pos, out, header, parse_float)
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 418, in key_value_rule
    pos, key, value = parse_key_value_pair(src, pos, parse_float)
                      ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 461, in parse_key_value_pair
    pos, value = parse_value(src, pos, parse_float)
                 ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 725, in parse_value
    datetime_match = RE_DATETIME.match(src, pos)
                     ^^^^^^^^^^^
ImportError: cannot import name 'RE_DATETIME' from 'tomllib._re' (/usr/lib64/python3.15/tomllib/_re.py)
python3 gendoc.py  "hg-ssh.8" > hg-ssh.8.txt.tmp
Traceback (most recent call last):
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 13, in <module>
    from ._re import (
ImportError: deferred import of 'tomllib._re.RE_DATETIME' raised an exception during resolution

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/doc/gendoc.py", line 48, in <module>
    initialization.init()
    ^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/initialization.py", line 67, in <module>
    admin_chainsaw.init()
    ^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/admin/chainsaw.py", line 46, in <module>
    command = registrar.command(tables.command_table)
              ^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/registrar.py", line 22, in <module>
    configitem = configitems.getitemregister
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 747, in exec_module
  File "<frozen importlib._bootstrap>", line 549, in _call_with_frames_removed
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 215, in <module>
    import_configitems_from_file()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 184, in import_configitems_from_file
    as_toml = read_configitems_file()
  File "/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/mercurial/configitems.py", line 155, in read_configitems_file
    return tomllib.load(fp)
           ~~~~~~~~~~~~^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 148, in load
    return loads(s, parse_float=parse_float)
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 189, in loads
    pos = key_value_rule(src, pos, out, header, parse_float)
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 418, in key_value_rule
    pos, key, value = parse_key_value_pair(src, pos, parse_float)
                      ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 461, in parse_key_value_pair
    pos, value = parse_value(src, pos, parse_float)
                 ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.15/tomllib/_parser.py", line 725, in parse_value
    datetime_match = RE_DATETIME.match(src, pos)
                     ^^^^^^^^^^^
ImportError: cannot import name 'RE_DATETIME' from 'tomllib._re' (/usr/lib64/python3.15/tomllib/_re.py)
make[1]: Leaving directory '/builddir/build/BUILD/mercurial-7.2.1-build/mercurial-7.2.1/doc'

https://docs.python.org/3.15/whatsnew/3.15.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.15-b1/fedora-rawhide-x86_64/10462782-mercurial/

For all our attempts to build mercurial with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15-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.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15-b1/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
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.

Comment 1 Mads Kiilerich 2026-05-19 18:14:27 UTC
I do not seem to be able to reproduce the problem with my local 3.15 .

At a glance it could seem to be a problem internal to Python tomllib.

It could potentially be caused by hgdemandimport, with a solution / workaround of blacklisting in hgdemandimport/__init__.py .

Comment 2 Tomáš Hrnčiar 2026-05-26 08:06:11 UTC
PR: https://src.fedoraproject.org/rpms/mercurial/pull-request/26#


Note You need to log in before you can comment on or make changes to this bug.