ijl / orjson

Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy
Apache License 2.0
6.29k stars 215 forks source link

Python 3.13 with no gil - SystemError: init function of orjson returned uninitialized object #520

Closed prabhu closed 1 month ago

prabhu commented 1 month ago

I am getting this error, while testing my project with python 3.13 with free-threading. Used the below code snippet to setup this in GitHub actions.

- name: Set up Python
       uses: deadsnakes/action@v3.2.0
       with:
         python-version: '3.13'
         nogil: true

Example failure: https://github.com/AppThreat/vulnerability-db/actions/runs/11240903455/job/31251265074#step:9:152

jpmckinney commented 1 month ago

Copy the actual failure here? That link doesn’t show any details under my account.

prabhu commented 1 month ago
test/test_npm.py:6: in <module>
    from vdb.lib.npm import NpmSource
        __builtins__ = <builtins>
        __cached__ = '/home/runner/work/vulnerability-db/vulnerability-db/test/__pycache__/test_npm.cpython-313.pyc'
        __doc__    = None
        __file__   = '/home/runner/work/vulnerability-db/vulnerability-db/test/test_npm.py'
        __loader__ = <_pytest.assertion.rewrite.AssertionRewritingHook object at 0x47db8508710>
        __name__   = 'test.test_npm'
        __package__ = 'test'
        __spec__   = ModuleSpec(name='test.test_npm', loader=<_pytest.assertion.rewrite.AssertionRewritingHook object at 0x47db8508710>, origin='/home/runner/work/vulnerability-db/vulnerability-db/test/test_npm.py')
        json       = <module 'json' from '/usr/lib/python3.13/json/__init__.py'>
        os         = <module 'os' (frozen)>
        pytest     = <module 'pytest' from '/home/runner/venv-3.13/lib/python3.13t/site-packages/pytest/__init__.py'>
vdb/lib/__init__.py:8: in <module>
    import orjson
        ABCMeta    = <class 'abc.ABCMeta'>
        Enum       = <enum 'Enum'>
        __builtins__ = <builtins>
        __cached__ = '/home/runner/work/vulnerability-db/vulnerability-db/vdb/lib/__pycache__/__init__.cpython-313.pyc'
        __doc__    = None
        __file__   = '/home/runner/work/vulnerability-db/vulnerability-db/vdb/lib/__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x47db88478d0>
        __name__   = 'vdb.lib'
        __package__ = 'vdb.lib'
        __path__   = ['/home/runner/work/vulnerability-db/vulnerability-db/vdb/lib']
        __spec__   = ModuleSpec(name='vdb.lib', loader=<_frozen_importlib_external.SourceFileLoader object at 0x47db88478d0>, origin='/home...ty-db/vdb/lib/__init__.py', submodule_search_locations=['/home/runner/work/vulnerability-db/vulnerability-db/vdb/lib'])
        abstractmethod = <function abstractmethod at 0x47db84[27](https://github.com/AppThreat/vulnerability-db/actions/runs/11240903455/job/31633478305#step:9:28)a80>
        datetime   = <class 'datetime.datetime'>
        os         = <module 'os' (frozen)>
        re         = <module 're' from '/usr/lib/python3.13/re/__init__.py'>
        tempfile   = <module 'tempfile' from '/usr/lib/python3.13/tempfile.py'>
../../../venv-3.13/lib/python3.13t/site-packages/orjson/__init__.py:3: in <module>
    from .orjson import *
E   SystemError: init function of orjson returned uninitialized object
        __builtins__ = <builtins>
        __cached__ = '/home/runner/venv-3.13/lib/python3.13t/site-packages/orjson/__pycache__/__init__.cpython-[31](https://github.com/AppThreat/vulnerability-db/actions/runs/11240903455/job/31633478305#step:9:32)3.pyc'
        __doc__    = None
        __file__   = '/home/runner/venv-3.13/lib/python3.13t/site-packages/orjson/__init__.py'
        __loader__ = <_frozen_importlib_external.SourceFileLoader object at 0x47db8847870>
        __name__   = 'orjson'
        __package__ = 'orjson'
        __path__   = ['/home/runner/venv-3.13/lib/python3.13t/site-packages/orjson']
        __spec__   = ModuleSpec(name='orjson', loader=<_frozen_importlib_external.SourceFileLoader object at 0x47db8847870>, origin='/home/...ckages/orjson/__init__.py', submodule_search_locations=['/home/runner/venv-3.13/lib/python3.13t/site-packages/orjson'])