Title: Builtin functions and methods lack a .__text_signature__ property · Issue #2410 · RustPython/RustPython · GitHub
Open Graph Title: Builtin functions and methods lack a .__text_signature__ property · Issue #2410 · RustPython/RustPython
X Title: Builtin functions and methods lack a .__text_signature__ property · Issue #2410 · RustPython/RustPython
Description: On CPython: >>> import inspect, struct >>> inspect.signature(struct.unpack_from)
Open Graph Description: On CPython: >>> import inspect, struct >>> inspect.signature(struct.unpack_from)
X Description: On CPython: >>> import inspect, struct >>> inspect.signature(struct.unpack_from) <Signature (format, /, buffer, offset=0)> Running this under the debugger (import pdb; pdb.r...
Opengraph URL: https://github.com/RustPython/RustPython/issues/2410
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Builtin functions and methods lack a .__text_signature__ property","articleBody":"On CPython:\r\n\r\n```py\r\n>>> import inspect, struct\r\n>>> inspect.signature(struct.unpack_from)\r\n\u003cSignature (format, /, buffer, offset=0)>\r\n```\r\n\r\nRunning this under the debugger (`import pdb; pdb.runcall(inspect.signature, struct.unpack_from)`), you see that `inspect` does ` getattr(struct.unpack_from, \"__text_signature__\")` which is defined in CPython [here](https://github.com/python/cpython/blob/0ec57e25c918b859b9f8d464e34e0ac859c2f8b3/Objects/methodobject.c#L193), and that's not implemented in RustPython, so you get this instead:\r\n\r\n```py\r\n>>>>> import inspect, struct\r\n>>>>> inspect.signature(struct.unpack_from)\r\nTraceback (most recent call last):\r\n File \"\u003cstdin>\", line 1, in \u003cmodule>\r\n File \"/home/boris/code/RustPython/vm/pylib-crate/Lib/inspect.py\", line 3093, in signature\r\n return Signature.from_callable(obj, follow_wrapped=follow_wrapped)\r\n File \"/home/boris/code/RustPython/vm/pylib-crate/Lib/inspect.py\", line 2843, in from_callable\r\n follow_wrapper_chains=follow_wrapped)\r\n File \"/home/boris/code/RustPython/vm/pylib-crate/Lib/inspect.py\", line 2297, in _signature_from_callable\r\n skip_bound_arg=skip_bound_arg)\r\n File \"/home/boris/code/RustPython/vm/pylib-crate/Lib/inspect.py\", line 2107, in _signature_from_builtin\r\n raise ValueError(\"no signature found for builtin {!r}\".format(func))\r\nValueError: no signature found for builtin \u003cbuiltin_function_or_method object at 0x55f59d0558d0>\r\n```\r\n","author":{"url":"https://github.com/verhovsky","@type":"Person","name":"verhovsky"},"datePublished":"2021-01-24T05:43:25Z","url":"https://github.com/RustPython/RustPython/issues/2410"}
| 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:8e3db5ae-2320-63ed-9c99-4d75aac9fc60 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E09E:16AB79:3C408A2:4C9133C:6B020903 |
| html-safe-nonce | 8c646979f65bc1defa8d2405a73565979cc7741306680539104ce1d6daea6ff4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDlFOjE2QUI3OTozQzQwOEEyOjRDOTEzM0M6NkIwMjA5MDMiLCJ2aXNpdG9yX2lkIjoiODMyMTY2NDgzNzYzMzU3NTE3MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | d181bdced147a2297bbd932932c1c04cd2e535feeef76ff31bfa972a4ee93258 |
| hovercard-subject-tag | issue:792726936 |
| 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/RustPython/RustPython/2410/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cde50f9e565df8937594e79d2c0c6fe5c599e561cbe421906a5fa64e2c7e0c13/RustPython/RustPython/issues/2410 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cde50f9e565df8937594e79d2c0c6fe5c599e561cbe421906a5fa64e2c7e0c13/RustPython/RustPython/issues/2410 |
| og:image:alt | On CPython: >>> import inspect, struct >>> inspect.signature(struct.unpack_from) |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | verhovsky |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git |
| octolytics-dimension-user_id | 39710557 |
| octolytics-dimension-user_login | RustPython |
| octolytics-dimension-repository_id | 135201145 |
| octolytics-dimension-repository_nwo | RustPython/RustPython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 135201145 |
| octolytics-dimension-repository_network_root_nwo | RustPython/RustPython |
| 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 | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width