Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with pypy interpreter #2

Open
sebastian-brunner opened this issue May 14, 2021 · 2 comments
Open

Incompatibility with pypy interpreter #2

sebastian-brunner opened this issue May 14, 2021 · 2 comments

Comments

@sebastian-brunner
Copy link
Member

When trying to use jsonconversion with the pypy interpreter (e.g. pypy3.6 /custom/patch/python-jsonconversion/test/test_jsonobjects.py) the following error occurs:

  File "/home/basti/develop/python-jsonconversion/test/test_jsonobjects.py", line 12, in <module>
    from testing_utils import convert_with_assertion
  File "/home/basti/develop/python-jsonconversion/test/testing_utils.py", line 17, in <module>
    from jsonconversion.encoder import JSONObjectEncoder
  File "/home/basti/develop/python-jsonconversion/src/jsonconversion/encoder.py", line 13, in <module>
    from json.encoder import JSONEncoder, _make_iterencode, encode_basestring, encode_basestring_ascii, INFINITY
ImportError: cannot import name '_make_iterencode'

The '_make_iterencode' is a protected member os json.encoder. Is there a possibility to only use the public API of json.encoder?

@franzlst
Copy link
Member

The docstring of the iterencode method that uses _make_iterencode explains why this import is required. Otherwise, the whole ~200 LOC function would be required to be copied into the module.

Does pypy not support the import of private methods or where is the exact problem?

@franzlst
Copy link
Member

I could imagine that the reason for the error is PyPy's custom json module. If so, it would be interesting if JSONConversion is in general able to work with PyPy's JSON module. Maybe you can locally copy the private function and verify that it is working then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants