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
Broken help() on metaclasses #79795
Comments
$ ./python -m pydoc abc
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_code
exec(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 cli
help.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in help
elif 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_doc
return title % desc + '\n\n' + renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 385, in document
if inspect.ismodule(object): return self.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 document
if inspect.isclass(object): return self.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) for cls in object.__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_main
return _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_code
exec(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 cli
help.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in help
elif 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_doc
return title % desc + '\n\n' + renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 385, in document
if inspect.ismodule(object): return self.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 document
if inspect.isclass(object): return self.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) for cls in object.__subclasses__()
TypeError: descriptor '__subclasses__' of 'type' object needs an argument "object" is a metaclass (abc.ABCMeta or enum.EnumMeta) in tracebacks above. The regression was introduced in bpo-8525. |
serhiy-storchaka
added
3.8
only security fixes
stdlib
Python modules in the Lib dir
type-bug
An unexpected behavior, bug, or error
labels
Dec 29, 2018
It fails also for builtin "type". $ ./python -m pydoc type
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/serhiy/py/cpython/Lib/runpy.py", line 85, in _run_code
exec(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 cli
help.help(arg)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1967, in help
elif 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_doc
return title % desc + '\n\n' + renderer.document(object, name)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 386, in document
if inspect.isclass(object): return self.docclass(*args)
File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1258, in docclass
(str(cls.__name__) for cls in object.__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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: