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

Issue with apispec.LazyDict, recursion limit reached #321

Open
soluwalana opened this issue Nov 21, 2018 · 1 comment
Open

Issue with apispec.LazyDict, recursion limit reached #321

soluwalana opened this issue Nov 21, 2018 · 1 comment

Comments

@soluwalana
Copy link

soluwalana commented Nov 21, 2018

>>> from apispec.lazy_dict import LazyDict
>>> x = LazyDict()
>>> x[1] = lambda: 203
>>> import ujson
>>> ujson.dumps(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Maximum recursion level reached

Not sure if I should leave this as a bug here or in apispec.

@hugovk
Copy link
Member

hugovk commented Mar 13, 2020

Thanks for the report.

I expect this has been fixed in UltraJSON 2.0 by 53f85b1:

Removed generic serialization of objects/iterables

The behavior of ujson has always been to try to serialize all objects in
any way possible. This has been quite a deviation from other json
libraries, including Pythons standard json module, and the source of a
lot of confusion and bugs. Removing this quirk moves ultrajson closer to
the expected behavior.

Instead of trying to coerce serialization ultrajson will now throw a
TypeError: "repr(obj) is not JSON serializable" exception.

Please could you retest with the latest release?

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

No branches or pull requests

2 participants