Title: Missing Signature Info for Builtin Exceptions in help() and Docs · Issue #111405 · python/cpython · GitHub
Open Graph Title: Missing Signature Info for Builtin Exceptions in help() and Docs · Issue #111405 · python/cpython
X Title: Missing Signature Info for Builtin Exceptions in help() and Docs · Issue #111405 · python/cpython
Description: 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 he...
Open Graph Description: 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...
X Description: 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. ...
Opengraph URL: https://github.com/python/cpython/issues/111405
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Missing Signature Info for Builtin Exceptions in help() and Docs","articleBody":"# Bug report\r\n\r\n### Bug description:\r\n\r\n(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.)\r\n\r\nThe `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)`.\r\n\r\nHere's an example (in the REPL) [^1]:\r\n\r\n```python\r\n>>> help(ExceptionGroup)\r\n | ...\r\n | __init__(self, /, *args, **kwargs)\r\n | Initialize self. See help(type(self)) for accurate signature.\r\n | ...\r\n```\r\n\r\n(The `help()` entry for `__new__()` is likewise unhelpful.)\r\n\r\n[^1]: FYI, I don't mean to pick on `ExceptionGroup`. It happened to be the one for which I first noticed the problem.\r\n\r\nThere is a similar lack of information in [the docs](https://docs.python.org/3/library/exceptions.html), though a handful of entries have at least some signature information.\r\n\r\nAll builtin exceptions (best effort catalog):\r\n\r\n| exception type | expected\\* (approximately)\u003cbr/>(incl. additional forms) | docs\u003cbr/>have\u003cbr/>sig |\r\n| --- | --- | --- |\r\n| Exception\u003cbr/>BaseException | `__init__(self, /, *args)` | |\r\n| ExceptionGroup\u003cbr/>BaseExceptionGroup | `__init__(self, msg, excs, /)` | X† |\r\n| StopIteration | `__init__(self, value=None, /, *args)` | |\r\n| SystemExit | `__init__(self, code=None, /, *args)` | |\r\n| ImportError | `__init__(self, /, name=None, path=None, name_from=None)` | |\r\n| OSError | `__init__(self, errno, strerror, filename=None, winerror=None, filename2=None, /)` | X† |\r\n| ^^^^^ | `__init__(self, arg=None, /)` | X† |\r\n| ^^^^^ | `__init__(self, /, *args)` | ‡ |\r\n| NameError | `__init__(self, /, *args, name=None)` | |\r\n| AttributeError | `__init__(self, /, *args, name=None, obj=None)` | |\r\n| SyntaxError | `__init__(self, msg, details, /)` | X† |\r\n| ^^^^^ | `__init__(self, msg=None, /, *args)` | ‡ |\r\n| UnicodeEncodeError | `__init__(self, encoding, obj, start, end, reason, /)` | |\r\n| UnicodeDecodeError | `__init__(self, encoding, obj, start, end, reason, /)` | |\r\n| UnicodeTranslateError | `__init__(self, obj, start, end, reason, /)` | |\r\n| -- all others (?) -- | -- same as `Exception`/`BaseException` -- | |\r\n\r\n\\* I derived expected signatures from the content of Objects/exceptions.c.\r\n† The doc entries for `OSError`, `ExceptionGroup`, and SyntaxError imply that they each take keyword arguments but they do not.\r\n‡ The doc entries for `OSError` and `SyntaxError` do not include the alternate signature.\r\n\r\n### CPython versions tested on:\r\n\r\nCPython main branch\r\n\r\n### Operating systems tested on:\r\n\r\n_No response_","author":{"url":"https://github.com/ericsnowcurrently","@type":"Person","name":"ericsnowcurrently"},"datePublished":"2023-10-27T16:48:23Z","url":"https://github.com/python/cpython/issues/111405"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ddd4762a-d818-ea02-eb2b-da3326fdf82f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 97FC:1A1C04:1EE606E:2A0DE9D:6B00176E |
| html-safe-nonce | 3e47e47bc22b7c738b9e9f50a04d9aff455f82b0eda105ae321882a938fd2df4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5N0ZDOjFBMUMwNDoxRUU2MDZFOjJBMERFOUQ6NkIwMDE3NkUiLCJ2aXNpdG9yX2lkIjoiNDI3MjEyMDEwNzU5NDk0NjQxNCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 058cf6e5a6046ef4541684e2f85ec24253472e08c59f0513a1bac1624e80061a |
| hovercard-subject-tag | issue:1965867528 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/111405/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6f441896cd2ffbe0e58678a67aeaf142a0573762a3e2ec3a5cc5c7b02cbb185/python/cpython/issues/111405 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6f441896cd2ffbe0e58678a67aeaf142a0573762a3e2ec3a5cc5c7b02cbb185/python/cpython/issues/111405 |
| og:image:alt | 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... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ericsnowcurrently |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width