GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Missing Signature Info for Builtin Exceptions in help() and Docs · Issue #111405 · python/cpython

Missing Signature Info for Builtin Exceptions in help() and Docs #111405

New issue
Copy link
New issue
Copy link
Open
Open
Missing Signature Info for Builtin Exceptions in help() and Docs#111405
Copy link
Labels
3.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@ericsnowcurrently
ericsnowcurrently
opened on Oct 27, 2023
Issue body actions

Bug report

Bug description:

(I've tagged this as a "docs" issue because help() is arguably a part of the documentation. Also, some of the docs entries have a similar lack of details. I suppose that could be dealt with separately.)

The help() text for (at least some) builtin exceptions doesn't show the type-specific signature for __init__() (or __new__()), instead showing a generic one with (self, /, *args, **kwargs).

Here's an example (in the REPL) 1:

>>> help(ExceptionGroup)
 | ...
 |  __init__(self, /, *args, **kwargs)
 |      Initialize self.  See help(type(self)) for accurate signature.
 | ...

(The help() entry for __new__() is likewise unhelpful.)

There is a similar lack of information in the docs, though a handful of entries have at least some signature information.

All builtin exceptions (best effort catalog):

exception type expected* (approximately)
(incl. additional forms)
docs
have
sig
Exception
BaseException
__init__(self, /, *args)
ExceptionGroup
BaseExceptionGroup
__init__(self, msg, excs, /) X†
StopIteration __init__(self, value=None, /, *args)
SystemExit __init__(self, code=None, /, *args)
ImportError __init__(self, /, name=None, path=None, name_from=None)
OSError __init__(self, errno, strerror, filename=None, winerror=None, filename2=None, /) X†
^^^^^ __init__(self, arg=None, /) X†
^^^^^ __init__(self, /, *args) ‡
NameError __init__(self, /, *args, name=None)
AttributeError __init__(self, /, *args, name=None, obj=None)
SyntaxError __init__(self, msg, details, /) X†
^^^^^ __init__(self, msg=None, /, *args) ‡
UnicodeEncodeError __init__(self, encoding, obj, start, end, reason, /)
UnicodeDecodeError __init__(self, encoding, obj, start, end, reason, /)
UnicodeTranslateError __init__(self, obj, start, end, reason, /)
-- all others (?) -- -- same as Exception/BaseException --

* I derived expected signatures from the content of Objects/exceptions.c.
† The doc entries for OSError, ExceptionGroup, and SyntaxError imply that they each take keyword arguments but they do not.
‡ The doc entries for OSError and SyntaxError do not include the alternate signature.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Footnotes

  1. FYI, I don't mean to pick on ExceptionGroup. It happened to be the one for which I first noticed the problem. ↩

Activity

  1. ericsnowcurrently
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    docsDocumentation in the Doc dirDocumentation in the Doc dir
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    3.11only security fixesonly security fixes
    3.12only security fixesonly security fixes
    3.13only security fixesonly security fixes
    on Oct 27, 2023
  2. brian030128 commented on Oct 29, 2023

    @brian030128
    brian030128
    on Oct 29, 2023
    More actions

    Hi I would like to work on this!

    Reacted by Eric Snow
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.11only security fixesonly security fixes3.12only security fixesonly security fixes3.13only security fixesonly security fixesdocsDocumentation in the Doc dirDocumentation in the Doc dirinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.