You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ ./python -m pydoc abc
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 192, in _run_module_as_mainreturn _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2765, in <module>
cli()
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2727, in clihelp.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in helpelif request: doc(request, 'Help on %s:', output=self._output)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1690, in doc
pager(render_doc(thing, title, forceload))
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1683, in render_docreturn title % desc +'\n\n'+ renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 385, in documentif inspect.ismodule(object): returnself.docmodule(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1182, in docmodule
contents.append(self.document(value, key, name))
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 386, in documentif inspect.isclass(object): returnself.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) forclsinobject.__subclasses__()
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
$ ./python -m pydoc enum
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 192, in _run_module_as_mainreturn _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2765, in <module>
cli()
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2727, in clihelp.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in helpelif request: doc(request, 'Help on %s:', output=self._output)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1690, in doc
pager(render_doc(thing, title, forceload))
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1683, in render_docreturn title % desc +'\n\n'+ renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 385, in documentif inspect.ismodule(object): returnself.docmodule(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1182, in docmodule
contents.append(self.document(value, key, name))
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 386, in documentif inspect.isclass(object): returnself.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) forclsinobject.__subclasses__()
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
"object" is a metaclass (abc.ABCMeta or enum.EnumMeta) in tracebacks above.
$ ./python -m pydoc type
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 192, in _run_module_as_mainreturn _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_codeexec(code, run_globals)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2765, in <module>
cli()
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2727, in clihelp.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in helpelif request: doc(request, 'Help on %s:', output=self._output)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1690, in doc
pager(render_doc(thing, title, forceload))
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1683, in render_docreturn title % desc +'\n\n'+ renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 386, in documentif inspect.isclass(object): returnself.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) forclsinobject.__subclasses__()
TypeError: descriptor '__subclasses__' of 'type' object needs an argument
There are two ways of solving this issue: 1) skip this chunk of code if object is a type subclass, 2) use type.__subclasses__(object) instead of object.__subclasses__().
Activity
serhiy-storchaka commentedon Dec 29, 2018
"object" is a metaclass (abc.ABCMeta or enum.EnumMeta) in tracebacks above.
The regression was introduced in bpo-8525.
serhiy-storchaka commentedon Dec 29, 2018
It fails also for builtin "type".
serhiy-storchaka commentedon Dec 29, 2018
There are two ways of solving this issue: 1) skip this chunk of code if object is a type subclass, 2) use
type.__subclasses__(object)instead ofobject.__subclasses__().ncoghlan commentedon Dec 31, 2018
New changeset b539cef by Nick Coghlan (Sanyam Khurana) in branch 'master':
bpo-35614: Fix pydoc help() on metaclasses (bpo-11357)
b539cef