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: patch-diff.githubusercontent.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:6c2c72df-b7e0-427d-7ed3-305bb0f6b464 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 807A:2567FD:B9DC77:1058EA3:696F43E9 |
| html-safe-nonce | 17cc334c4fae54f803214ae128d9cf3c06460d8d4693c3c07638b6e074a414e5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDdBOjI1NjdGRDpCOURDNzc6MTA1OEVBMzo2OTZGNDNFOSIsInZpc2l0b3JfaWQiOiI0MTc5Mjc2NjAyNjg5OTMwMjE3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d1fe98660255ed19a13ff62fbbf2a639c3b32dfaff9d2f6603e8c1531ed3725b |
| 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 | b278ad162d35332b6de714dfb005de04386c4d92df6475522bef910f491a35ee |
| 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 | 39aed5006635ab6f45e6b77d23e73b08a00272a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width