Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 933474 - dev-vcs/mercurial[rust] not working with python 3.12
Summary: dev-vcs/mercurial[rust] not working with python 3.12
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Cédric Krier
URL:
Whiteboard:
Keywords:
: 933842 (view as bug list)
Depends on:
Blocks:
 
Reported: 2024-06-03 14:16 UTC by KiR
Modified: 2024-06-10 06:21 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description KiR 2024-06-03 14:16:14 UTC
dev-vcs/mercurial with USE=rust not working with python 3.12, even with PYTHON_TARGETS="3.11"

Error: ImportError: /usr/lib/python3.12/site-packages/mercurial/rustext.cpython-312-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_Ready

Reproducible: Always

Steps to Reproduce:
1. emerge dev-vcs/mercurial with USE=rust

Actual Results:  
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/hg", line 59, in <module>
    dispatch.run()
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 142, in run
    status = dispatch(req)
             ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 231, in dispatch
    status = _rundispatch(req)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 253, in _rundispatch
    req.ui = uimod.ui.load()
             ^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/mercurial/ui.py", line 234, in <module>
    class ui:
  File "/usr/lib/python3.12/site-packages/mercurial/ui.py", line 2125, in ui
    ) -> scmutil.progress:
         ^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/mercurial/scmutil.py", line 59, in <module>
    rustrevlog = policy.importrust('revlog')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/policy.py", line 138, in importrust
    mod = _importfrom('rustext', modname)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/policy.py", line 61, in _importfrom
    pkg = __import__(pkgname, globals(), fakelocals, [modname], level=1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 252, in create_module
ImportError: /usr/lib/python3.12/site-packages/mercurial/rustext.cpython-312-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_Ready

Expected Results:  
working mercurial
Comment 1 Gabriele Svelto 2024-06-06 12:54:53 UTC
Same issue here, and it seems to affect all current versions, both stable and unstable. I tried rebuilding mercurial and its dependencies with the python3_11 target and the problem goes away.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-06 13:03:00 UTC
I'll try take a look later if cedk doesn't, but I'm changing machines atm.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 11:49:56 UTC
Looking.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 15:09:44 UTC
Reproduced w/ trivial `hg` when USE=rust is on:
```
$ hg
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.12/hg", line 59, in <module>
    dispatch.run()
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 142, in run
    status = dispatch(req)
             ^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 231, in dispatch
    status = _rundispatch(req)
             ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/dispatch.py", line 253, in _rundispatch
    req.ui = uimod.ui.load()
             ^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/mercurial/ui.py", line 234, in <module>
    class ui:
  File "/usr/lib/python3.12/site-packages/mercurial/ui.py", line 2125, in ui
    ) -> scmutil.progress:
         ^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 208, in __getattribute__
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3.12/site-packages/mercurial/scmutil.py", line 59, in <module>
    rustrevlog = policy.importrust('revlog')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/policy.py", line 138, in importrust
    mod = _importfrom('rustext', modname)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/mercurial/policy.py", line 61, in _importfrom
    pkg = __import__(pkgname, globals(), fakelocals, [modname], level=1)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib.util>", line 252, in create_module
ImportError: /usr/lib/python3.12/site-packages/mercurial/rustext.cpython-312-x86_64-linux-gnu.so: undefined symbol: _PyUnicode_Ready
```
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 15:11:16 UTC
well, _PyUnicode_Ready isn't in Python 3.12, so...
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 15:13:08 UTC
Three choices:
1) We drop 3.12 on mercurial;
2) We p.use.mask USE=rust on mercurial;
3) REQUIRED_USE for rust vs python3_12

I prefer 2). mgorny, cedk?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 15:14:15 UTC
Wait, they're not using pyo3?  This is just insane.
Comment 8 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 15:42:27 UTC
(In reply to Sam James from comment #6)
> Three choices:
> 1) We drop 3.12 on mercurial;
> 2) We p.use.mask USE=rust on mercurial;
> 3) REQUIRED_USE for rust vs python3_12
> 
> I prefer 2). mgorny, cedk?

Yeah, mask it.
Comment 9 Cédric Krier gentoo-dev 2024-06-07 16:12:11 UTC
I think it is better to set REQUIRED_USE for rust vs python3_12 as it reflects better the constraint.
Comment 10 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 16:13:37 UTC
(In reply to Cédric Krier from comment #9)
> I think it is better to set REQUIRED_USE for rust vs python3_12 as it
> reflects better the constraint.

It's poor UX as it means it's not emergable out of the box, is the problem.
Comment 11 Cédric Krier gentoo-dev 2024-06-07 16:25:25 UTC
(In reply to Sam James from comment #10)
> (In reply to Cédric Krier from comment #9)
> > I think it is better to set REQUIRED_USE for rust vs python3_12 as it
> > reflects better the constraint.
> 
> It's poor UX as it means it's not emergable out of the box, is the problem.

But rust still work on other Python version and it is a big performance boost (especially on server side).
So we may have users who will unmask it but still compile with python3_12.
Also when upstream will fix it, we will have some versions that needs to be masked and others not.
For me it seems better to manage that at the ebuild level.
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-06-07 16:26:31 UTC
Fedora have coped with removing it entirely, so it can't be that important? ;)

Anyway, I won't insist, but I think it's going to be poor for users.
Comment 13 Larry the Git Cow gentoo-dev 2024-06-07 16:50:11 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e394eb879bbbe11e85526e7813d989cd87d7084c

commit e394eb879bbbe11e85526e7813d989cd87d7084c
Author:     Cédric Krier <cedk@gentoo.org>
AuthorDate: 2024-06-07 16:48:33 +0000
Commit:     Cédric Krier <cedk@gentoo.org>
CommitDate: 2024-06-07 16:50:05 +0000

    dev-vcs/mercurial: forbid rust extension with python3_12
    
    Closes: https://bugs.gentoo.org/933474
    Signed-off-by: Cédric Krier <cedk@gentoo.org>

 dev-vcs/mercurial/mercurial-6.5.3.ebuild | 2 ++
 dev-vcs/mercurial/mercurial-6.6.2.ebuild | 2 ++
 dev-vcs/mercurial/mercurial-6.7.3.ebuild | 2 ++
 dev-vcs/mercurial/mercurial-9999.ebuild  | 2 ++
 4 files changed, 8 insertions(+)
Comment 14 Cédric Krier gentoo-dev 2024-06-10 06:21:35 UTC
*** Bug 933842 has been marked as a duplicate of this bug. ***