Skip to content

Broken help() on metaclasses #79795

Closed
Closed

Description

@serhiy-storchaka
BPO 35614
Nosy @ncoghlan, @abalkin, @merwok, @serhiy-storchaka, @CuriousLearner
PRs
  • bpo-35614: Fix pydoc help() on metaclasses #11357
  • bpo-35614: Fix pydoc help() on metaclasses #11357
  • bpo-35614: Fix pydoc help() on metaclasses #11357
  • 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:

    assignee = None
    closed_at = <Date 2018-12-31.05:19:43.925>
    created_at = <Date 2018-12-29.15:21:50.099>
    labels = ['3.8', 'type-bug', 'library']
    title = 'Broken help() on metaclasses'
    updated_at = <Date 2018-12-31.05:19:43.924>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-12-31.05:19:43.924>
    actor = 'ncoghlan'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-12-31.05:19:43.925>
    closer = 'ncoghlan'
    components = ['Library (Lib)']
    creation = <Date 2018-12-29.15:21:50.099>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 35614
    keywords = ['patch', 'patch', 'patch']
    message_count = 4.0
    messages = ['332720', '332726', '332727', '332802']
    nosy_count = 5.0
    nosy_names = ['ncoghlan', 'belopolsky', 'eric.araujo', 'serhiy.storchaka', 'CuriousLearner']
    pr_nums = ['11357', '11357', '11357']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue35614'
    versions = ['Python 3.8']

    Activity

    1. serhiy-storchaka commented on Dec 29, 2018

      @serhiy-storchaka
      MemberAuthor
      $ ./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.

    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-bugAn unexpected behavior, bug, or error
      on Dec 29, 2018
    3. serhiy-storchaka commented on Dec 29, 2018

      @serhiy-storchaka
      MemberAuthor

      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
    4. serhiy-storchaka commented on Dec 29, 2018

      @serhiy-storchaka
      MemberAuthor

      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__().

    5. ncoghlan commented on Dec 31, 2018

      @ncoghlan
      Contributor

      New changeset b539cef by Nick Coghlan (Sanyam Khurana) in branch 'master':
      bpo-35614: Fix pydoc help() on metaclasses (bpo-11357)
      b539cef

    6. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.8 (EOL)end of lifestdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions