Skip to content

Commit

Permalink
feat: Attempt yajl_c with PyPy ICRAR/ijson#82 ICRAR/ijson#101
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Jan 30, 2024
1 parent 53f8a38 commit c125b36
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions ocdskit/util.py
Expand Up @@ -3,26 +3,11 @@
import platform
from decimal import Decimal

import ijson
from ocdsmerge.util import get_tags

from ocdskit.exceptions import UnknownFormatError, UnknownVersionError

if platform.python_implementation() == 'PyPy':
import importlib

# yajl_c causes C errors. https://github.com/open-contracting/ocdskit/issues/178
# See ijson/__init__.py::_default_backend
for backend in ('yajl2_cffi', 'yajl2', 'yajl', 'python'):
try:
ijson = importlib.import_module(f'ijson.backends.{backend}')
break
except ImportError:
pass
else:
raise ImportError('no ijson backends available')
else:
import ijson

try:
import orjson

Expand Down

0 comments on commit c125b36

Please sign in to comment.