mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merge: #17476: make allmethods actually return all methods.
This fixes a regression relative to Python2. (In 2, methods on a class were unbound methods and matched the inspect queries being done, in 3 they are just functions and so were missed). This is an undocumented function that pydoc itself does not use, but I found that numpy at least uses it in its documentation generator. Original patch by Matt Bachmann.
This commit is contained in:
parent
3a61943b7b
commit
ac0cea5fab
3 changed files with 31 additions and 1 deletions
|
@ -132,7 +132,10 @@ def stripid(text):
|
|||
return _re_stripid.sub(r'\1', text)
|
||||
|
||||
def _is_some_method(obj):
|
||||
return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj)
|
||||
return (inspect.isfunction(obj) or
|
||||
inspect.ismethod(obj) or
|
||||
inspect.isbuiltin(obj) or
|
||||
inspect.ismethoddescriptor(obj))
|
||||
|
||||
def allmethods(cl):
|
||||
methods = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue