-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
pdb's whatis command reports method as function #85775
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
Comments
pdb's whatis command prints 'Function' instead of 'Method' for a bound method: > python.bat
Running Release|Win32 interpreter...
Python 3.10.0a0 (heads/master-dirty:12695f4c6d, Aug 21 2020, 15:48:06) [MSC v.1916 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyClass:
... def mymethod(self):
... pass
...
>>> import pdb
>>> pdb.set_trace()
--Return--
> <stdin>(1)<module>()->None
(Pdb) whatis MyClass().mymethod
Function mymethod
(Pdb) MyClass().mymethod
<bound method MyClass.mymethod of <__main__.MyClass object at 0x0131D5C8>>
(Pdb) |
The reason for this that it first checks whether there is a __code__ attribute (which both methods and functions have) and only afterwards checks for __func__.__code__. I will submit a patch with a test and fix shortly. |
It should really use inspect.* functions but I think that should be done separately from this fix. |
Thank you for your contribution, Irit! |
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: