Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

msgpack.fallback DEFAULT_RECURSE_LIMIT smaller than python 3.10 default #674

Copy link
Copy link

Description

@rsiemens
Issue body actions

Hi there. I was running the pure python msgpack.fallback implementation against this sample.json test file in the tencent/rapidjson repo. Packing hit a ValueError: recursion limit exceeded.

It looks like this stems from the DEFAULT_RECURSE_LIMIT. Changing to use the sys.getrecursionlimit() resolves as it has a default of 1000 in 3.10. Looking at the pyproject.toml it seems like support is >= python 3.10 so I think it should be fine to update the constant, or drop it completely in favor of just inheriting the python stack limit. An advantage of doing that is the users ability to control it with sys.setrecursionlimit(). Also then a RecursionError can be raised instead of ValueError.

Simple reproduction:

from msgpack.fallback import Packer
import json

with open('sample.json') as f:
    Packer().pack(json.load(f))  # ValueError

This works fine, but the public Packer.pack api doesn't expose it directly:

from msgpack.fallback import Packer
import json
import sys

with open('sample.json') as f:
    Packer()._pack(json.load(f), nest_limit=sys.getrecursionlimit())  # 1000

Thanks!

Reactions are currently unavailable

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.