Fix ValueError on wrapper loops in inspect.unwrap#607
Merged
gaborbernat merged 7 commits intoFeb 17, 2026
Conversation
Catch ValueError from inspect.unwrap() in both process_signature and process_docstring. This fixes crashes when documenting objects with circular __wrapped__ chains, such as SQLAlchemy's mapped_column. Fixes tox-dev#405
worksbyfriday
force-pushed
the
fix-wrapper-loop-valueerror
branch
from
February 17, 2026 22:47
f9ca136 to
22e5f0e
Compare
Pass empty dict and strings for unused parameters, adding type: ignore annotation since the test only exercises the inspect.unwrap ValueError guard path. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
The dict literal needs the arg-type ignore (Options expected), but the str arguments are already compatible with str params. Co-Authored-By: Claude Opus 4.6 <[email protected]>
gaborbernat
requested changes
Feb 17, 2026
gaborbernat
left a comment
Member
There was a problem hiding this comment.
Please run and fix the pre-ocmmit checks.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Author
|
Fixed — added PLR0912 to the noqa suppression on |
gaborbernat
requested changes
Feb 17, 2026
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Contributor
Author
|
Fixed — now passing |
gaborbernat
approved these changes
Feb 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Catches
ValueErrorfrominspect.unwrap()in bothprocess_signatureandprocess_docstring. This fixes crashes when documenting objects with circular__wrapped__chains, such as SQLAlchemy'smapped_column.Fixes #405
Changes
process_signature: wrapsinspect.unwrap(obj)in try/except ValueError, returns None on failure (skips signature processing)process_docstring: wrapsinspect.unwrap(obj)in try/except ValueError, returns early on failure (skips docstring processing)test_process_docstring_wrapper_loopandtest_process_signature_wrapper_loopTest plan
__wrapped__and verify no ValueError is raised