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

Python3.11: invalid help query raises an ImportError #98374

Closed
qexat opened this issue Oct 18, 2022 · 3 comments
Closed

Python3.11: invalid help query raises an ImportError #98374

qexat opened this issue Oct 18, 2022 · 3 comments
Labels
3.11 only security fixes 3.12 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@qexat
Copy link

qexat commented Oct 18, 2022

Bug report

Running this on Python 3.11 REPL:

>>> help("invalid query")

Raises the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<frozen _sitebuiltins>", line 103, in __call__
  File "/usr/lib/python3.11/pydoc.py", line 2001, in __call__
    self.help(request)
  File "/usr/lib/python3.11/pydoc.py", line 2057, in help
    elif request: doc(request, 'Help on %s:', output=self._output)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pydoc.py", line 1784, in doc
    pager(render_doc(thing, title, forceload))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pydoc.py", line 1758, in render_doc
    object, name = resolve(thing, forceload)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pydoc.py", line 1744, in resolve
    raise ImportError('''\
ImportError: No Python documentation found for 'invalid query'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

Python 3.10.8 (and most probably any 3.10.*) simply prints this:

No Python documentation found for 'invalid query'.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.

Your environment

  • CPython versions tested on: 3.11.0, 3.10.8
  • Operating system and architecture: EndeavourOS, kernel: 6.0.1-arch2-1 (64-bit)

Apparently, this is due to commit 8868d48712aee2b490efaf60bed8dfe9fb14d6b7 (thanks to @asottile for finding it).

Is it expected behavior though?

@iritkatriel
Copy link
Member

Possibly due to #27868.

@iritkatriel iritkatriel added 3.11 only security fixes 3.12 bugs and security fixes needs backport to 3.11 only security fixes stdlib Python modules in the Lib dir labels Oct 18, 2022
@qexat
Copy link
Author

qexat commented Oct 18, 2022

Possibly due to #27868.

Indeed, the commit I mention was present in this PR.

corona10 added a commit to corona10/cpython that referenced this issue Oct 19, 2022
corona10 added a commit to corona10/cpython that referenced this issue Oct 19, 2022
corona10 added a commit to corona10/cpython that referenced this issue Oct 19, 2022
corona10 added a commit to corona10/cpython that referenced this issue Oct 20, 2022
…p() command. (pythongh-98450)

(cherry picked from commit 4156b2f)

Co-authored-by: Dong-hee Na <donghee.na@python.org>
@corona10 corona10 removed the needs backport to 3.11 only security fixes label Oct 20, 2022
carljm added a commit to carljm/cpython that referenced this issue Oct 20, 2022
* main: (40 commits)
  pythongh-98461: Fix source location in comprehensions bytecode (pythonGH-98464)
  pythongh-98421: Clean Up PyObject_Print (pythonGH-98422)
  pythongh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (pythonGH-98462)
  CODEOWNERS: Become a typing code owner (python#98480)
  [doc] Improve logging cookbook example. (pythonGH-98481)
  Add more tkinter.Canvas tests (pythonGH-98475)
  pythongh-95023: Added os.setns and os.unshare functions (python#95046)
  pythonGH-98363: Presize the list for batched() (pythonGH-98419)
  pythongh-98374: Suppress ImportError for invalid query for help() command. (pythongh-98450)
  typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (python#98351)
  pythongh-98354: Add unicode check for 'name' attribute in _imp_create_builtin (pythonGH-98412)
  pythongh-98257: Make _PyEval_SetTrace() reentrant (python#98258)
  pythongh-98414: py.exe launcher does not use defaults for -V:company/ option (pythonGH-98460)
  pythongh-98417: Store int_max_str_digits on the Interpreter State (pythonGH-98418)
  Doc: Remove title text from internal links (python#98409)
  [doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (pythonGH-98350)
  Docs: Bump sphinx-lint and fix unbalanced inline literal markup (python#98441)
  pythongh-92886: Replace assertion statements in `handlers.BaseHandler` to support running with optimizations (`-O`) (pythonGH-93231)
  pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `_test_multiprocessing.py` (pythonGH-93233)
  pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_py_compile.py` (pythonGH-93235)
  ...
@terryjreedy
Copy link
Member

terryjreedy commented Jun 12, 2023

(EDIT) This fix did not catch all cases. See #102541 for help()...help> invalid giving a traceback ending in the same place with the same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

4 participants