Bug 2263013 - python-orjson fails to build with Python 3.13: ImportError: /builddir/build/BUILDROOT/python-orjson-3.9.12-3.fc40.x86_64/usr/lib64/python3.13/site-packages/orjson/orjson.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyDict_Next
Summary: python-orjson fails to build with Python 3.13: ImportError: /builddir/build/B...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-orjson
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Maxwell G
QA Contact:
URL:
Whiteboard:
Depends On: 2262570
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2024-02-06 15:33 UTC by Karolina Surma
Modified: 2024-08-09 15:38 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2024-08-09 15:38:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2024-02-06 15:33:49 UTC
python-orjson fails to build with Python 3.13.0a3.

+ /usr/bin/python3 -sP /usr/lib/rpm/redhat/import_all_modules.py -f /builddir/build/BUILD/python-orjson-3.9.12-3.fc40.x86_64-pyproject-modules
Check import: orjson
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 171, in <module>
    main()
    ~~~~^^
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 167, in main
    import_modules(modules)
    ~~~~~~~~~~~~~~^^^^^^^^^
  File "/usr/lib/rpm/redhat/import_all_modules.py", line 100, in import_modules
    importlib.import_module(module)
    ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1012, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/builddir/build/BUILDROOT/python-orjson-3.9.12-3.fc40.x86_64/usr/lib64/python3.13/site-packages/orjson/__init__.py", line 3, in <module>
    from .orjson import *
ImportError: /builddir/build/BUILDROOT/python-orjson-3.9.12-3.fc40.x86_64/usr/lib64/python3.13/site-packages/orjson/orjson.cpython-313-x86_64-linux-gnu.so: undefined symbol: _PyDict_Next

_PyDict is one of the many private C-APIs that have been removed from Python 3.13 (moved to internal): https://github.com/python/cpython/issues/106320

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06989511-python-orjson/

For all our attempts to build python-orjson with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-orjson/

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.13:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Miro Hrončok 2024-02-06 15:46:53 UTC
See also https://github.com/ijl/orjson/issues/177#issuecomment-962429954

Apparently, orjson uses private undocumented functions in CPython API, which has previously caused PyPy to not be supported.

Comment 3 Fabio Valentini 2024-02-06 15:55:43 UTC
I suspect a proper fix for Python 3.13 will require a new version of PyO3 to adapt to the C API changes.

Comment 4 Ben Beasley 2024-08-09 15:38:38 UTC
(In reply to Fabio Valentini from comment #3)
> I suspect a proper fix for Python 3.13 will require a new version of PyO3 to
> adapt to the C API changes.

The package has built for Python 3.13 without any downstream workarounds since 3.9.13, so I’m going to close this bug even if there are still things that could be fixed or improved upstream.


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