René's URL Explorer Experiment


Title: Try to re-add stubs for ctypes by dgelessus · Pull Request #1906 · python/typeshed · GitHub

Open Graph Title: Try to re-add stubs for ctypes by dgelessus · Pull Request #1906 · python/typeshed

X Title: Try to re-add stubs for ctypes by dgelessus · Pull Request #1906 · python/typeshed

Description: Two years ago, some stubs for ctypes were added (#454) but removed soon afterwards, because they caused problems with correct code (#475). As I understand it, this was in part because of limitations in mypy at the time. Some of these limitations don't seem to exist anymore, so I tried to make the ctypes stubs work again. I took the code in its last state before it was removed and tried to fix the issues reported in #475, as well as a few issues that I came across myself when using the stubs with my own code. Details on what exactly I've changed can be found in the individual commit messages. I'm sure there are still issues that I haven't noticed, so if anyone has a ctypes-using codebase and could try out these stubs, I would be happy to get some feedback. Finally, I'd like to note that I don't have a lot of experience with mypy and writing typing stubs. Previously I've type-annotated some bits of my code and used typeshed through PyCharm's typechecker, but other than that this is my first time properly using mypy and typing. So if there's anything that I'm doing incorrectly or not according to convention, please let me know! 😃

Open Graph Description: Two years ago, some stubs for ctypes were added (#454) but removed soon afterwards, because they caused problems with correct code (#475). As I understand it, this was in part because of limitation...

X Description: Two years ago, some stubs for ctypes were added (#454) but removed soon afterwards, because they caused problems with correct code (#475). As I understand it, this was in part because of limitation...

Opengraph URL: https://github.com/python/typeshed/pull/1906

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:a8ff94a3-cbdb-aeee-00bd-cc676613d62a
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE608:1E3154:104F583:15EAAF4:6B005E0C
html-safe-nonce773a766f97ea3ce5be6a34eb8815d0aae4fc8d212e1eb5b6674bc54993384932
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNjA4OjFFMzE1NDoxMDRGNTgzOjE1RUFBRjQ6NkIwMDVFMEMiLCJ2aXNpdG9yX2lkIjoiNDIwMjQ1NzYxOTI0OTUyMDE0MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac829a777fc532ead852a9e5864ab147bba7bbffcae8b3f13f915ffc3aa5ac11b8
hovercard-subject-tagpull_request:170337339
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/python/typeshed/pull/1906/files
twitter:imagehttps://avatars.githubusercontent.com/u/6641959?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/6641959?s=400&v=4
og:image:altTwo years ago, some stubs for ctypes were added (#454) but removed soon afterwards, because they caused problems with correct code (#475). As I understand it, this was in part because of limitation...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releaseeacd927ba6112e3b01ba99c762bd699a4a4f5df7
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/typeshed/pull/1906/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fpull%2F1906%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fpull%2F1906%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=python%2Ftypeshed
Reloadhttps://github.com/python/typeshed/pull/1906/files
Reloadhttps://github.com/python/typeshed/pull/1906/files
Reloadhttps://github.com/python/typeshed/pull/1906/files
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests252 (252)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fpython%2Ftypeshed%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fpython%2Ftypeshed%2Fissues%2Fnew%2Fchoose
JelleZijlstrahttps://github.com/JelleZijlstra
python:masterhttps://github.com/python/typeshed/tree/master
dgelessus:readd_ctypeshttps://github.com/dgelessus/typeshed/tree/readd_ctypes
Conversation 22 https://github.com/python/typeshed/pull/1906
Commits 32 https://github.com/python/typeshed/pull/1906/commits
Checks 0 https://github.com/python/typeshed/pull/1906/checks
Files changed https://github.com/python/typeshed/pull/1906/files
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
Try to re-add stubs for ctypes https://github.com/python/typeshed/pull/1906/files#top
Show all changes 32 commits https://github.com/python/typeshed/pull/1906/files
acb456f Revert "Delete ctypes. It is not yet ready for prime time, alas." dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/acb456f17ca47361662238fbbf0c82de53e64b04
acb3758 Convert type comments to variable annotations in ctypes.__init__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/acb3758e4091ce843aeff3ef3ab97ec86bac5eb4
45ac1a7 Add missing List import in ctypes.__init__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/45ac1a7b1dc84287dfa03814508c2f376a7bcd32
38fabd0 Add missing bound kwarg to _CT TypeVar in ctypes.__init__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/38fabd0d0cb857c5487baba41608bd5cfa559a44
265a831 Fix ctypes._CData classmethod definitions dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/265a831df3d4872c7be0cbfadd6187c54da6ea79
2bb0fe9 Fix ctypes Structure/Union __getattr__ definitions dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/2bb0fe9015e05f0bc58d21db33e83d632b4c92be
a73cd5e Fix ctypes._CData classmethod definitions properly this time dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/a73cd5e47a0890519539fefc09fbfdd65bcdec35
8919823 Fix swapped parameter types in ctypes._CData.in_dll dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/891982300ab00da937d2c03e561d6da7f709dc59
0dc881a Add limited support for ctypes._CData.__class__.__mul__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/0dc881afe3cc613e2af9f5b2c1582e484486f3de
ba2a9e5 Make ctypes._FuncPtr extend ctypes._CData dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/ba2a9e5ff3a5e7b799b2511a1e0416e09899f883
aabc546 Improve typing of ctypes.cast dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/aabc54639a544e321b6ab0b900de1fff324e3ddd
8841185 Mark class attributes with ClassVar in ctypes.__init__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/88411852cd2c5b5a91cee7a319715978c386c750
0413982 Mark ctypes._CData.from_buffer[_copy] offset arg as optional dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/041398276d8d0bd3b1f505971fecff6783820c0a
50e44c9 Remove trailing whitespace in ctypes.__init__ dgelessus Feb 20, 2018 https://github.com/python/typeshed/pull/1906/commits/50e44c9959105803f65991ec64d42659eaae1f1f
535a008 Don't export ctypes.UnionT dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/535a0085b0c71dff6d56e5ddae88edb8add32b5d
aedd0d9 Add ctypes._DLL.__getitem__ dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/aedd0d920cc4f51137945883ef11a9a29e52eb8c
2311ced Make ctypes._DLL.__get(attr|item)__ return _FuncPtr instead of Any dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/2311ced308ba66f542fc161f336aff40303e1cc9
854e22e Change ctypes DLL inheritance hierarchy to match the real one better dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/854e22ebd3d5006a9bd0e76525e9a53c1e8532f4
e765dec Add some missing attributes to ctypes.CDLL dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/e765dec75bc59aa25e97d62a605e1dbcd6e3b701
7a34b64 Rename ctypes._FuncPtr so it doesn't conflict with CDLL._FuncPtr dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/7a34b64bea114ea652e3fa01940caa6e30e642ce
0619771 Fix type of ctypes.CDLL._FuncPtr dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/0619771e7b376ebccdc52149a6c700b12b76211d
94a9853 Merge _FuncProto into _FuncPointer dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/94a985357da8a4e3f684f61248321abc40906b16
1091074 Fix some leftover references to ctypes._DLL dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/1091074699255b92be5866db7509c683541a0ceb
253fc4a Simplify definition of ctypes._DLLT dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/253fc4a7f16895373ef712cd16d90fd4a44397fc
cc3f49a Add ctypes.LibraryLoader.__get(attr|item)__ dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/cc3f49a2a78b591ccbcb48c57f9fcf146ec9df0b
7ff6017 Use Text instead of str where appropriate in ctypes.__init__ dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/7ff6017f6805843c733374afe3e3fb7f746e4125
66a74a8 Make ctypes.c_char accept ints dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/66a74a821e2dd4e910001eb5f06f6011a4580179
e5d1642 Make ctypes.c_[w]char_p accept None dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/e5d164238a98cd4ffd95b9905baf63309433bd41
b81de47 Remove unneeded Generic base from ctypes.py_object dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/b81de47acefef9b59a9b6ce0dd86036f33415058
a7507ea Make ctypes.cast accept _cparam dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/a7507ea7906616c1e2cc5977f2d84e5ea2e0b046
d8d431e Fix ctypes._PF being declared too late dgelessus Mar 6, 2018 https://github.com/python/typeshed/pull/1906/commits/d8d431e7f07079e2dfe6ab4a10a3bde938fcd120
a38f579 Remove incorrect ctypes.PyDLL.__init__ override dgelessus Mar 7, 2018 https://github.com/python/typeshed/pull/1906/commits/a38f5790ae4d9306c4a6d9e102fdbcf1a2a02358
Clear filters https://github.com/python/typeshed/pull/1906/files
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
__init__.pyi https://github.com/python/typeshed/pull/1906/files#diff-426e0cfdc777c06cc98af3d41ce74ff43cda09e33b318e8b7cd842be5a8c0322
util.pyi https://github.com/python/typeshed/pull/1906/files#diff-8b123c5c4f9af3dd994796bf71fc1d14850f44995052a1e7c4905105a288a3eb
stdlib/2and3/ctypes/__init__.pyihttps://github.com/python/typeshed/pull/1906/files#diff-426e0cfdc777c06cc98af3d41ce74ff43cda09e33b318e8b7cd842be5a8c0322
View file https://github.com/dgelessus/typeshed/blob/a38f5790ae4d9306c4a6d9e102fdbcf1a2a02358/stdlib/2and3/ctypes/__init__.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/1906/{{ revealButtonHref }}
eric-wieserhttps://github.com/eric-wieser
Nov 19, 2018https://github.com/python/typeshed/pull/1906/files#r234798828
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
dgelessushttps://github.com/dgelessus
Nov 19, 2018https://github.com/python/typeshed/pull/1906/files#r234815913
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
buffer protocolhttps://docs.python.org/3/c-api/buffer.html
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
ilevkivskyihttps://github.com/ilevkivskyi
Nov 19, 2018https://github.com/python/typeshed/pull/1906/files#r234818006
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
ilevkivskyihttps://github.com/ilevkivskyi
Nov 19, 2018https://github.com/python/typeshed/pull/1906/files#r234818361
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
eric-wieserhttps://github.com/eric-wieser
Nov 20, 2018https://github.com/python/typeshed/pull/1906/files#r234827674
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
srittauhttps://github.com/srittau
Nov 20, 2018https://github.com/python/typeshed/pull/1906/files#r234831276
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
typing documentationhttps://docs.python.org/3/library/typing.html?highlight=bytestring
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
dgelessushttps://github.com/dgelessus
Nov 20, 2018https://github.com/python/typeshed/pull/1906/files#r234837753
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
#2610https://github.com/python/typeshed/pull/2610
Please reload this pagehttps://github.com/python/typeshed/pull/1906/files
stdlib/2and3/ctypes/util.pyihttps://github.com/python/typeshed/pull/1906/files#diff-8b123c5c4f9af3dd994796bf71fc1d14850f44995052a1e7c4905105a288a3eb
View file https://github.com/dgelessus/typeshed/blob/a38f5790ae4d9306c4a6d9e102fdbcf1a2a02358/stdlib/2and3/ctypes/util.pyi
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/python/typeshed/pull/1906/{{ revealButtonHref }}
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.