-
-
Notifications
You must be signed in to change notification settings - Fork 61
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Description of the bug
When parsing an expression with a huge number of binary operators, like this one in sympy, griffe fails with a RecursionError because it exceeds the recursion limit.
To Reproduce
With latest griffe installed as an executable:
git clone --depth=1 https://github.com/sympy/sympy
griffe dump sympy/sympy/polys/numberfields/resolvent_lookup.pyFull traceback
INFO Loading package sympy/sympy/polys/numberfields/resolvent_lookup.py
ERROR sympy/sympy/polys/numberfields/resolvent_lookup.py:7: Failed to get expression from Dict: RecursionError: maximum recursion depth exceeded
Traceback (most recent call last):
File "/Users/user/.local/bin/griffe", line 12, in <module>
sys.exit(main())
~~~~^^
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/cli.py", line 568, in main
return commands[subcommand](**opts_dict)
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/cli.py", line 389, in dump
loader = _load_packages(
packages,
...<10 lines>...
find_stubs_package=find_stubs_package,
)
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/cli.py", line 101, in _load_packages
loader.load(package, try_relative_path=True, find_stubs_package=find_stubs_package)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/loader.py", line 184, in load
return self._post_load(top_module, obj_path)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/loader.py", line 198, in _post_load
obj = self.modules_collection.get_member(obj_path)
File "/Users/user/Library/Application Support/uv/tools/griffe/lib/python3.13/site-packages/griffe/_internal/mixins.py", line 83, in get_member
return self.members[parts[0]] # type: ignore[attr-defined]
~~~~~~~~~~~~^^^^^^^^^^
KeyError: 'resolvent_lookup'Separately, I used an editable install of griffe and let the error propagate:
File "/Users/user/dev/external/griffe/src/griffe/_internal/expressions.py", line 1355, in _build
return _node_map[type(node)](node, parent, **kwargs)
File "/Users/user/dev/external/griffe/src/griffe/_internal/expressions.py", line 1086, in _build_binop
_build(node.left, parent, **kwargs),
File "/Users/user/dev/external/griffe/src/griffe/_internal/expressions.py", line 1355, in _build
return _node_map[type(node)](node, parent, **kwargs)
File "/Users/user/dev/external/griffe/src/griffe/_internal/expressions.py", line 1086, in _build_binop
_build(node.left, parent, **kwargs),
File "/Users/user/dev/external/griffe/src/griffe/_internal/expressions.py", line 1355, in _build
return _node_map[type(node)](node, parent, **kwargs)
RecursionError: maximum recursion depth exceeded in comparisonExpected behavior
The unreasonably large expression parses.
Environment information
- System: macOS-15.5-arm64-arm-64bit-Mach-O
- Python: cpython 3.13.2 (/Users/user/Library/Application Support/uv/tools/griffe/bin/python)
- Environment variables:
- Installed packages:
griffev1.11.1
Additional context
Thanks for the excellent package!
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working