Title: Add `stdlib/_ctypes` · Issue #8571 · python/typeshed · GitHub
Open Graph Title: Add `stdlib/_ctypes` · Issue #8571 · python/typeshed
X Title: Add `stdlib/_ctypes` · Issue #8571 · python/typeshed
Description: My projects use some COM-ffi packages. I use _ctypes.COMError or _ctypes.CopyComPointer too, but they are not defined in the type stub, so mypy type checker raises Cannot find implementation or library stub for module named "_ctypes" err...
Open Graph Description: My projects use some COM-ffi packages. I use _ctypes.COMError or _ctypes.CopyComPointer too, but they are not defined in the type stub, so mypy type checker raises Cannot find implementation or lib...
X Description: My projects use some COM-ffi packages. I use _ctypes.COMError or _ctypes.CopyComPointer too, but they are not defined in the type stub, so mypy type checker raises Cannot find implementation or lib...
Opengraph URL: https://github.com/python/typeshed/issues/8571
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add `stdlib/_ctypes`","articleBody":"My projects use some COM-ffi packages.\r\n\r\nI use `_ctypes.COMError` or `_ctypes.CopyComPointer` too, but they are not defined in the type stub, so `mypy` type checker raises `Cannot find implementation or library stub for module named \"_ctypes\"` error.\r\n\r\nI would like to add type stubs like this.\r\n```py\r\nfrom ctypes import _CArgObject, _PointerLike\r\n# are they correct?\r\n_COMError_Details = tuple[str | None, str | None, str | None, int | None, int | None] # Description, Source, HelpFile, HelpContext, scode\r\n\r\nclass COMError(Exception):\r\n \"\"\"Raised when a COM method call failed.\"\"\"\r\n hresult: int\r\n text: str\r\n details: _COMError_Details\r\n\r\n def __init__(self, hresult: _COMError_HResult, text: str, details: _COMError_Details) -\u003e None: ...\r\n\r\n\r\ndef CopyComPointer(src: _PointerLike, dst: _PointerLike | _CArgObject) -\u003e int: ... # `dst` sometimes maybe return value of `ctypes.byref`.\r\n \"\"\"CopyComPointer(src, dst) -\u003e HRESULT value\"\"\"\r\n```\r\n\r\nBut other APIs are not clear to me.\r\n- and where the `if sys.platform == \"win32\":` needed.\r\n\r\nAny opinions would be appreciated.","author":{"url":"https://github.com/junkmd","@type":"Person","name":"junkmd"},"datePublished":"2022-08-20T02:55:45.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/8571/typeshed/issues/8571"}
| 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:28c5ce89-27e8-b600-937f-0912a7703b17 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A51E:BC066:ACCA1:F27FF:6A61BE34 |
| html-safe-nonce | 4f51a5c05460b15d0482ab5f6ebbd24ea14aeff1b3cd4b7bc0a7e953844aaf47 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNTFFOkJDMDY2OkFDQ0ExOkYyN0ZGOjZBNjFCRTM0IiwidmlzaXRvcl9pZCI6IjQ1MTY0OTg5NTc4Mzg0MzM4NDQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7f480ab341432d699d835e5299c4902cf43098df3f5617879e7b69a052627956 |
| hovercard-subject-tag | issue:1345036809 |
| 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/typeshed/8571/issue_layout |
| twitter:image | https://opengraph.githubassets.com/d1431b50e0281f4c67b19089a7ca2bdf31a6529702effe8730d18fb0d16fdb01/python/typeshed/issues/8571 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/d1431b50e0281f4c67b19089a7ca2bdf31a6529702effe8730d18fb0d16fdb01/python/typeshed/issues/8571 |
| og:image:alt | My projects use some COM-ffi packages. I use _ctypes.COMError or _ctypes.CopyComPointer too, but they are not defined in the type stub, so mypy type checker raises Cannot find implementation or lib... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | junkmd |
| hostname | github.com |
| expected-hostname | github.com |
| None | 6f4633bcf01c1ad14b73fd07dd39ac31d61f3d3c2578ee08ec1792b7b351eeb9 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| 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 | ac296ae7f21856f1f92adbad22f870b6fbb4b907 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width