Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue35614

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:Broken help() on metaclasses
Type:behaviorStage:resolved
Components:Library (Lib)Versions:Python 3.8
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To:Nosy List: CuriousLearner, belopolsky, eric.araujo, ncoghlan, serhiy.storchaka
Priority:normalKeywords:patch, patch, patch

Created on2018-12-29 15:21 byserhiy.storchaka, last changed2022-04-11 14:59 byadmin. This issue is nowclosed.

Pull Requests
URLStatusLinkedEdit
PR 11357mergedCuriousLearner,2018-12-29 18:45
PR 11357mergedCuriousLearner,2018-12-29 18:45
PR 11357mergedCuriousLearner,2018-12-29 18:45
Messages (4)
msg332720 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-12-29 15:21
$ ./python -m pydoc abcTraceback (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 enumTraceback (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 inissue8525.
msg332726 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-12-29 17:35
It fails also for builtin "type".$ ./python -m pydoc typeTraceback (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
msg332727 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2018-12-29 17:51
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__()`.
msg332802 -(view)Author: Alyssa Coghlan (ncoghlan)*(Python committer)Date: 2018-12-31 05:14
New changesetb539cef31c060c7eecc331d25a23b80ded0baf08 by Nick Coghlan (Sanyam Khurana) in branch 'master':bpo-35614: Fix pydoc help() on metaclasses (#11357)https://github.com/python/cpython/commit/b539cef31c060c7eecc331d25a23b80ded0baf08
History
DateUserActionArgs
2022-04-11 14:59:09adminsetgithub: 79795
2018-12-31 05:19:43ncoghlansetkeywords:patch,patch,patch
status: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-12-31 05:14:50ncoghlansetmessages: +msg332802
2018-12-29 18:45:45CuriousLearnersetkeywords: +patch
stage: patch review
pull_requests: +pull_request10672
2018-12-29 18:45:36CuriousLearnersetkeywords: +patch
stage: (no value)
pull_requests: +pull_request10671
2018-12-29 18:45:26CuriousLearnersetkeywords: +patch
stage: (no value)
pull_requests: +pull_request10670
2018-12-29 17:51:31serhiy.storchakasetmessages: +msg332727
2018-12-29 17:35:51serhiy.storchakasetmessages: +msg332726
2018-12-29 15:21:50serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp