Skip to content

Pydoc fails for test.test_enum #116600

Closed
Closed
@serhiy-storchaka

Description

@serhiy-storchaka

Bug report

$ ./python -m pydoc test.test_enum
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 198, in _run_module_as_main
    return _run_code(code, main_globals, None,
           ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
                     "__main__", mod_spec)
                     ^^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/runpy.py", line 88, in _run_code
    exec(code, run_globals)
    ~~~~^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2948, in <module>
    cli()
    ~~~^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2909, in cli
    help.help(arg, is_cli=True)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 2165, in help
    elif request: doc(request, 'Help on %s:', output=self._output, is_cli=is_cli)
                  ~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1881, in doc
    pager(render_doc(thing, title, forceload))
          ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1874, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
                                   ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 521, in document
    if inspect.ismodule(object): return self.docmodule(*args)
                                        ~~~~~~~~~~~~~~^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1341, in docmodule
    contents.append(self.document(value, key, name))
                    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 522, in document
    if inspect.isclass(object): return self.docclass(*args)
                                       ~~~~~~~~~~~~~^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1512, in docclass
    attrs = spilldata("Data and other attributes %s:\n" % tag, attrs,
            ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                      lambda t: t[1] == 'data')
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1475, in spilldata
    push(self.docother(obj, name, mod, maxlen=70, doc=doc) +
         ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1620, in docother
    repr = self.repr(object)
           ~~~~~~~~~^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/reprlib.py", line 60, in repr
    return self.repr1(x, self.maxlevel)
           ~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/home/serhiy/py/cpython/Lib/pydoc.py", line 1213, in repr1
    return cram(stripid(repr(x)), self.maxother)
                        ~~~~^^^
  File "/home/serhiy/py/cpython/Lib/enum.py", line 1685, in global_flag_repr
    if _is_single_bit(self):
       ~~~~~~~~~~~~~~^^^^^^
  File "/home/serhiy/py/cpython/Lib/enum.py", line 96, in _is_single_bit
    num &= num - 1
           ~~~~^~~
TypeError: unsupported operand type(s) for -: 'NoName' and 'int'

cc @ethanfurman

Linked PRs

Metadata

Metadata

Assignees

Labels

3.11only security fixes3.12only security fixes3.13bugs and security fixesstdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions