-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
inspect.signature() raises RuntimeError on failed to resolve the default argument value #87284
Comments
inspect.signature() raises RuntimeError on failed to resolve the default argument value. For example, it fails to inspect a subclass of io.BufferedReader: Example:
Result:
In my investigation, inspect.signature() tries to evaluate the default argument value of the class constructor. But it fails to evaluate because of the 2nd argument of the constructor takes a constant; I think it would be better to search the constants for the modules of the base classes. I just made a simple patch to resolve this bug. |
FWIW, I succeeded to inspect the class with importing the constant from the base module as a workaround:
|
any question about this issue? if not, i think it is better to close it |
Looks like this was fixed in 3.9, the repro doesn't raise there. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: