Title: Support __text_signature__ generation for C extensions · Issue #593 · oracle/graalpython · GitHub
Open Graph Title: Support __text_signature__ generation for C extensions · Issue #593 · oracle/graalpython
X Title: Support __text_signature__ generation for C extensions · Issue #593 · oracle/graalpython
Description: The CPython has no "official" way to specify signatures in extension modules. I did (unsuccessful) attempt to address this issue in https://discuss.python.org/t/43914. One approach (e.g. sphinx-doc) is using the PEP 7-style docstrings: T...
Open Graph Description: The CPython has no "official" way to specify signatures in extension modules. I did (unsuccessful) attempt to address this issue in https://discuss.python.org/t/43914. One approach (e.g. sphinx-doc...
X Description: The CPython has no "official" way to specify signatures in extension modules. I did (unsuccessful) attempt to address this issue in https://discuss.python.org/t/43914. One approach (e.g. ...
Opengraph URL: https://github.com/oracle/graalpython/issues/593
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support __text_signature__ generation for C extensions","articleBody":"The CPython has no \"official\" way to specify signatures in extension modules. I did (unsuccessful) attempt to address this issue in https://discuss.python.org/t/43914.\n\nOne approach (e.g. sphinx-doc) is using the [PEP 7](https://peps.python.org/pep-0007/#documentation-strings)-style docstrings:\n\u003e The first line of each function docstring should be a “signature line” that gives a brief synopsis of the arguments and return value.\n\nAnother one, used by CPython's builtin's and stdlib - fill the `__text_signature__` attribute for callables like:\n```\nfunction_name(arguments)\n--\n\nactual docstring, *without* PEP 7 \"signature line\".\n```\nThe ``function_name(arguments)`` line (with some specific syntax for the first function argument, you shouldn't care about) literally goes to the ``__text_signature__`` attribute. While it's not a public API, hardly this interface will disappear soon. Thus, some alternative Python implementation sometimes offer support for this way (though, incomplete, see e.g. pypy/pypy#5368). Maybe GraalPy can too?\n\nIf no, maybe you could cut off all leading text from docstrings, before and including of the ``\\n--\\n\\n`` separator? So, it will not appear in the help() output as now (using the python-gmp package as an example):\n```pycon\nPython 3.12.8 (Thu Oct 09 17:26:36 UTC 2025)\n[Graal, Oracle GraalVM, Java 25.0.1 (amd64)] on linux\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n\u003e\u003e\u003e from gmp import isqrt\n\u003e\u003e\u003e print(isqrt.__doc__)\nisqrt($module, n, /)\n--\n\nReturn the integer part of the square root of n.\n\u003e\u003e\u003e help(isqrt)\nHelp on built-in function isqrt in module gmp:\n\nisqrt(...)\n isqrt($module, n, /)\n --\n\n Return the integer part of the square root of n.\n\n```","author":{"url":"https://github.com/skirpichev","@type":"Person","name":"skirpichev"},"datePublished":"2026-01-15T06:42:21.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/593/graalpython/issues/593"}
| 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:7566c433-2bef-4b3a-5663-2c323d6f9269 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E890:60C6C:37A467:4B2E16:69696B9D |
| html-safe-nonce | 7d166ce258b66587f40378c88c52ef90ab7f8aa4625afdc8b8e655763cfb07e8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFODkwOjYwQzZDOjM3QTQ2Nzo0QjJFMTY6Njk2OTZCOUQiLCJ2aXNpdG9yX2lkIjoiNDY0NTA1MjE5OTQ4NDM1MzQzNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 64cb3be3b05725a3da1387e4d99be4a48a95f7a924560d26d68ffedc23f1c780 |
| hovercard-subject-tag | issue:3816232263 |
| 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/oracle/graalpython/593/issue_layout |
| twitter:image | https://opengraph.githubassets.com/23aad56f626be05c912d8121307d8908df35e6981d6a4bedd981eb227269a091/oracle/graalpython/issues/593 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/23aad56f626be05c912d8121307d8908df35e6981d6a4bedd981eb227269a091/oracle/graalpython/issues/593 |
| og:image:alt | The CPython has no "official" way to specify signatures in extension modules. I did (unsuccessful) attempt to address this issue in https://discuss.python.org/t/43914. One approach (e.g. sphinx-doc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | skirpichev |
| hostname | github.com |
| expected-hostname | github.com |
| None | c6f193beb8ff08443adc07685d75302ab8aaf0a135f6e251c3ff3112c8deb881 |
| turbo-cache-control | no-preview |
| go-import | github.com/oracle/graalpython git https://github.com/oracle/graalpython.git |
| octolytics-dimension-user_id | 4430336 |
| octolytics-dimension-user_login | oracle |
| octolytics-dimension-repository_id | 129883600 |
| octolytics-dimension-repository_nwo | oracle/graalpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 129883600 |
| octolytics-dimension-repository_network_root_nwo | oracle/graalpython |
| 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 | ec4d88fbe7ed62446d90b0a6d8e6db4248a8f8b8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width