Skip to content

Help function throws error with sqlite3 module #101717

Description

@kbidlack

Bug report

When running the help function on the sqlite3 module, a RuntimeError is thrown:

>>> import sqlite3
>>> help(sqlite3)
Traceback (most recent call last):
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2222, in wrap_value
    value = eval(s, module_dict)
            ^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
NameError: name 'ConnectionType' is not defined. Did you mean: 'Connection'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2225, in wrap_value
    value = eval(s, sys_module_dict)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
NameError: name 'ConnectionType' is not defined. Did you mean: 'ConnectionError'?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen _sitebuiltins>", line 103, in __call__
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 2002, in __call__
    self.help(request)
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 2063, in help
    else: doc(request, 'Help on %s:', output=self._output)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 1784, in doc
    pager(render_doc(thing, title, forceload))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 1778, in render_doc
    return title % desc + '\n\n' + renderer.document(object, name)
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 479, in document
    if inspect.ismodule(object): return self.docmodule(*args)
                                        ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 1275, in docmodule
    contents.append(self.document(value, key, name))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 481, in document
    if inspect.isroutine(object): return self.docroutine(*args)
                                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/pydoc.py", line 1494, in docroutine
    signature = inspect.signature(object)
                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 3278, in signature
    return Signature.from_callable(obj, follow_wrapped=follow_wrapped,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 3026, in from_callable
    return _signature_from_callable(obj, sigcls=cls,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2518, in _signature_from_callable
    return _signature_from_builtin(sigcls, obj,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2327, in _signature_from_builtin
    return _signature_fromstr(cls, func, s, skip_bound_arg)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2275, in _signature_fromstr
    p(name, default)
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2257, in p
    default_node = RewriteSymbolics().visit(default_node)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/ast.py", line 418, in visit
    return visitor(node)
           ^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2249, in visit_Name
    return wrap_value(node.id)
           ^^^^^^^^^^^^^^^^^^^
  File "/Users/kavi/.pyenv/versions/3.11.1/lib/python3.11/inspect.py", line 2227, in wrap_value
    raise RuntimeError()
RuntimeError

Your environment

  • CPython versions tested on: 3.11.1
  • Operating system and architecture: MacOS (intel)

Activity

  1. OTheDev commented on Feb 9, 2023

    @OTheDev
    Contributor

    This is a known issue. See #99003.

    It is fixed in 3.11.2 (:

  2. arhadthedev commented on Feb 9, 2023

    @arhadthedev
    Member

    It is fixed in 3.11.2 (:

    More details: #99003 (comment).

  3. arhadthedev commented on Feb 9, 2023

    @arhadthedev
    Member

    Closing as a duplicate of gh-99003.

  4. arhadthedev commented on Feb 9, 2023

    @arhadthedev
    Member

    I've brought it up in #83685 (comment) though; see there for further discussion.

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

    stdlibStandard Library Python modules in the Lib/ directorytopic-sqlite3type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions