Bug 2249383

Summary: mercurial depends on unmaintained cpython crate - issues with Python 3.12
Product: [Fedora] Fedora Reporter: Fabio Valentini <decathorpe>
Component: mercurialAssignee: Mads Kiilerich <mads>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: rawhideCC: alebastr89, fedoraproject.org, mads, ndbecker2, opohorel, pstodulk
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-07-22 15:07:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Fabio Valentini 2023-11-12 17:31:43 UTC
The "cpython" crate is now officially unmaintained [0], and it does not support Python 3.12 [1]. Notably, due to ABI changes in Python 3.12, I cannot even guarantee that this package currently works correctly when used in conjunction with Python 3.12 (affecting both Fedora 39 and Rawhide).

c.f. https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/XG7GMDZFL2RO4QHEFBJKU7YDE3AZBRVM/#XG7GMDZFL2RO4QHEFBJKU7YDE3AZBRVM

The upstream author of the "cpython" crate recommends to migrate to pyo3. Versions 0.19.2 and newer of pyo3 support Python 3.12. If possible, I would recommend to work with mercurial upstream to migrate to pyo3 v0.19.2 or newer as soon as possible.

[0]: https://github.com/dgrunwald/rust-cpython/commit/e815555
[1]: https://github.com/dgrunwald/rust-cpython/issues/294

Reproducible: Always

Comment 1 Aleksei Bavshin 2024-01-18 20:07:48 UTC
checking encoding (UTF-8)...
checking Python executable (/usr/bin/python3)
checking Python implementation (CPython)
checking Python version (3.12.1)
checking Python lib (/usr/lib64/python3.12)...
checking Python security support (sni,tls1.0,tls1.1,tls1.2)
checking Rust extensions (missing)
checking Mercurial version (6.6.2)
checking Mercurial custom build ()
checking module policy (rust+c-allow)
checking installed modules (/usr/lib64/python3.12/site-packages/mercurial)...
 /usr/lib64/python3.12/site-packages/mercurial/rustext.cpython-312-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_Ready

(mercurial-6.6.2-1.fc40.x86_64, mercurial-rust-6.6.2-1.fc40.x86_64)

So no, it doesn't work correctly with Python 3.12.

In practice, this may result in

    abort: accessing `persistent-nodemap` repository without associated fast implementation.
    (check `hg help config.format.use-persistent-nodemap` for details)

if the repo was cloned with Rust extensions available.

Comment 2 Fabio Valentini 2024-04-03 16:22:40 UTC
FYI, I intend to retire the package for the "cpython" crate from Fedora 41+.
It was abandoned by upstream and does not work with Python >=3.12, so as soon as Fedora 38 is EOL, the crate will not work on any current branch of Fedora.

I would recommend that the Rust extensions for mercurial are disabled on Fedora 39+.

Comment 3 Mads Kiilerich 2024-04-19 19:53:23 UTC
The rust subpackage is dropped in mercurial-6.5.3-2.fc39 ... and f40 and rawhide.

Comment 4 Fabio Valentini 2024-04-19 21:52:23 UTC
Thank you!

I'm hoping it can be brought back in the future.

Comment 5 Mads Kiilerich 2024-07-22 15:07:13 UTC
https://crates.io/crates/cpython/0.7.2 was released with backports to make it work with Python 3.12 - it is apparently used by Facebook.

It is however just a potential temporary workaround, and it is probably not worth the effort to restore the package.

Comment 6 Fabio Valentini 2024-07-23 12:56:05 UTC
Note that Rawhide is already on Python 3.13, which has additional breaking changes on top of those needed to support Python 3.12.