-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Bug: incorrect function is_singledispatch_method
and bugs with classmethod
decorator
#11531
Comments
Yes, this is likely related to #11278. I remember that one particularity is because of
Since we are dropping Python 3.8 support, I'd gladly fix this for the next release (when I'm done with the other tasks). Actually, the reason why I think I will try to see which approach is actually the best. Maybe I'll need to rethink the logic of my current PR. |
Why is this related to dropping Python3.8? @picnixz But thanks for taking care of that :-) |
On our side, the |
Ok good to know :-) This was not documented in functools to my knowledge, glad you found that! |
So here's an update:
|
Describe the bug
The
sphinx.util.inspect.is_singledispatch_method
appears to be incorrect.sphinx/sphinx/util/inspect.py
Lines 282 to 284 in c9f0e67
Even though the decorator is defined as a class, using
isinstance
will never work (see example below).singledispatchmethod
definition: https://github.com/python/cpython/blob/a9e5e59b7d912b4a90c550fad6a2d208bf8a1ed9/Lib/functools.py#L902C3-L935How to Reproduce
The following code fails.
Environment Information
The error comes from the fact the
obj.__wrapped.__doc__
isclassmethod
's documentation, and not the original function documentation. To obtain such information, you need to getobj.__wrapped..__func__.__doc__
Additional context
I could patch this issue with following preprocessor (defined in
conf.py
):Related issues: #11278?
The text was updated successfully, but these errors were encountered: