Skip to content
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

Help function throws error with sqlite3 module #101717

Closed
kbidlack opened this issue Feb 8, 2023 · 4 comments
Closed

Help function throws error with sqlite3 module #101717

kbidlack opened this issue Feb 8, 2023 · 4 comments
Labels
stdlib Python modules in the Lib dir topic-sqlite3 type-bug An unexpected behavior, bug, or error

Comments

@kbidlack
Copy link

kbidlack commented Feb 8, 2023

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)
@kbidlack kbidlack added the type-bug An unexpected behavior, bug, or error label Feb 8, 2023
@OTheDev
Copy link
Contributor

OTheDev commented Feb 9, 2023

This is a known issue. See #99003.

It is fixed in 3.11.2 (:

@arhadthedev arhadthedev added stdlib Python modules in the Lib dir topic-sqlite3 labels Feb 9, 2023
@arhadthedev
Copy link
Member

It is fixed in 3.11.2 (:

More details: #99003 (comment).

@arhadthedev
Copy link
Member

Closing as a duplicate of gh-99003.

@arhadthedev arhadthedev closed this as not planned Won't fix, can't repro, duplicate, stale Feb 9, 2023
@arhadthedev
Copy link
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
Labels
stdlib Python modules in the Lib dir topic-sqlite3 type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants