René's URL Explorer Experiment


Title: ctypes: fix Windows pip truststore by youknowone · Pull Request #8314 · RustPython/RustPython · GitHub

Open Graph Title: ctypes: fix Windows pip truststore by youknowone · Pull Request #8314 · RustPython/RustPython

X Title: ctypes: fix Windows pip truststore by youknowone · Pull Request #8314 · RustPython/RustPython

Description: Summary preserve the foreign-call result when a ctypes errcheck callback returns the exact args tuple accept c_char_p and c_wchar_p instances when initializing matching pointer arrays add focused stdlib_ctypes.py regressions and a Windows pip HTTPS smoke test using pip's vendored truststore implement PyEval_SaveThread/PyEval_RestoreThread so blocking C API callers detach from stop-the-world Closes #8281. Root cause RustPython unconditionally replaced a foreign function's result with the value returned by errcheck. Truststore returns the original args tuple to request normal result processing, so RustPython changed the Windows certificate-store handle into a tuple. Passing that tuple to the next c_void_p argument raised TypeError: wrong type. After preserving the handle, truststore reached its enhanced-key-usage setup and initialized a c_char_p array from an existing c_char_p instance. RustPython's specialized string-pointer array writer accepted bytes and integer addresses, but not a matching ctypes pointer instance. CI hang root cause The Ubuntu C API job exposed an existing threading bug: PyEval_SaveThread and PyEval_RestoreThread were no-ops. A parent test thread could therefore remain attached while joining a child that requested stop-the-world, leaving each thread waiting for the other. The implementation now preserves the VM stack and GILState-owned VM across detach/restore, and the C API test forces a stop-the-world cycle to cover the deadlock deterministically. Validation uvx prek run --all-files cargo clippy -p rustpython-vm -p rustpython-capi --all-targets supported Windows workspace test suite Linux C API suite (98 tests), including 100 repeated parallel runs all snippet tests under CPython 3.14 and RustPython (400 passed, 4 skipped) uvx zizmor --min-severity low .github/workflows/ci.yaml isolated ensurepip followed by pip download six over HTTPS on Windows Summary by CodeRabbit New Features Added native thread save/restore support that preserves VM/GIL context when threads detach and later restore (threading feature). Bug Fixes Improved _ctypes errcheck handling so the original result is only replaced when the checker returns a different value. Enhanced _ctypes array element writing for c_char_p/c_wchar_p-style pointer types to write pointer values directly from compatible simple instances. Updated Windows overlapped I/O completion to run with threads allowed to prevent blocking VM thread execution. Tests Expanded _ctypes snippet coverage for char pointers and Windows kernel32 ctypes validation. CI Added a Windows-only HTTPS trust-store connectivity smoke test for pip snippet execution.

Open Graph Description: Summary preserve the foreign-call result when a ctypes errcheck callback returns the exact args tuple accept c_char_p and c_wchar_p instances when initializing matching pointer arrays add focused ...

X Description: Summary preserve the foreign-call result when a ctypes errcheck callback returns the exact args tuple accept c_char_p and c_wchar_p instances when initializing matching pointer arrays add focused ...

Opengraph URL: https://github.com/RustPython/RustPython/pull/8314

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:cb47d177-e4be-e9e0-eefa-0739c17d2053
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE0EA:30AAFB:DABE8:1354EB:6A604F5E
html-safe-noncea66bc81e51ec2222351f49369ff72b19acd813c680360f5a24d4eac307e4e7fa
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEVBOjMwQUFGQjpEQUJFODoxMzU0RUI6NkE2MDRGNUUiLCJ2aXNpdG9yX2lkIjoiNTE0MDc1MjUxNzA3Mzc1MTkwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac3f16d41f2ea67ff3ef6de5150df224edfd8b7291464e2bfe3d29fda7221c05cf
hovercard-subject-tagpull_request:4081858222
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/RustPython/RustPython/pull/8314/files
twitter:imagehttps://avatars.githubusercontent.com/u/69878?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/69878?s=400&v=4
og:image:altSummary preserve the foreign-call result when a ctypes errcheck callback returns the exact args tuple accept c_char_p and c_wchar_p instances when initializing matching pointer arrays add focused ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None60da8c2a42fa2bbf5f7567474990ec467836a84444262a58e200fa91b7f3d2d0
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/RustPython/RustPython git https://github.com/RustPython/RustPython.git
octolytics-dimension-user_id39710557
octolytics-dimension-user_loginRustPython
octolytics-dimension-repository_id135201145
octolytics-dimension-repository_nwoRustPython/RustPython
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id135201145
octolytics-dimension-repository_network_root_nwoRustPython/RustPython
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
release9824515e740d83d5eb82168a089b806ab0fe04a1
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/RustPython/RustPython/pull/8314/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8314%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FRustPython%2FRustPython%2Fpull%2F8314%2Ffiles
Sign up https://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=RustPython%2FRustPython
Reloadhttps://github.com/RustPython/RustPython/pull/8314/files
Reloadhttps://github.com/RustPython/RustPython/pull/8314/files
Reloadhttps://github.com/RustPython/RustPython/pull/8314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
RustPython https://github.com/RustPython
RustPythonhttps://github.com/RustPython/RustPython
Notifications https://github.com/login?return_to=%2FRustPython%2FRustPython
Fork 1.5k https://github.com/login?return_to=%2FRustPython%2FRustPython
Star 22.2k https://github.com/login?return_to=%2FRustPython%2FRustPython
Code https://github.com/RustPython/RustPython
Issues 294 https://github.com/RustPython/RustPython/issues
Pull requests 105 https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality 0 https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
Code https://github.com/RustPython/RustPython
Issues https://github.com/RustPython/RustPython/issues
Pull requests https://github.com/RustPython/RustPython/pulls
Discussions https://github.com/RustPython/RustPython/discussions
Actions https://github.com/RustPython/RustPython/actions
Projects https://github.com/RustPython/RustPython/projects
Models https://github.com/RustPython/RustPython/models
Wiki https://github.com/RustPython/RustPython/wiki
Security and quality https://github.com/RustPython/RustPython/security
Insights https://github.com/RustPython/RustPython/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FRustPython%2FRustPython%2Fissues%2Fnew%2Fchoose
youknowonehttps://github.com/youknowone
RustPython:mainhttps://github.com/RustPython/RustPython/tree/main
youknowone:agent/fix-ctypes-errcheckhttps://github.com/youknowone/RustPython/tree/agent/fix-ctypes-errcheck
Conversation 6 https://github.com/RustPython/RustPython/pull/8314
Commits 4 https://github.com/RustPython/RustPython/pull/8314/commits
Checks 25 https://github.com/RustPython/RustPython/pull/8314/checks
Files changed https://github.com/RustPython/RustPython/pull/8314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
ctypes: fix Windows pip truststore https://github.com/RustPython/RustPython/pull/8314/files#top
Show all changes 4 commits https://github.com/RustPython/RustPython/pull/8314/files
b0f0baa ctypes: preserve result when errcheck returns args youknowone Jul 18, 2026 https://github.com/RustPython/RustPython/pull/8314/commits/b0f0baad53b67a8b66288d95af531d9a967850da
7eed565 ctypes: cover Windows pip truststore youknowone Jul 18, 2026 https://github.com/RustPython/RustPython/pull/8314/commits/7eed565146dcf23c2aed27c0a6d77d8196bd5aa2
94ed9ed capi: implement PyEval_SaveThread youknowone Jul 19, 2026 https://github.com/RustPython/RustPython/pull/8314/commits/94ed9ed4512be80b1017c5a55d49f96ab74f506b
c200885 capi: merge saved thread state into PyThreadState youknowone Jul 20, 2026 https://github.com/RustPython/RustPython/pull/8314/commits/c200885bad48b7c7dacb03ed47faa9462f7c9576
Clear filters https://github.com/RustPython/RustPython/pull/8314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
ci.yaml https://github.com/RustPython/RustPython/pull/8314/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
pystate.rs https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
overlapped.rs https://github.com/RustPython/RustPython/pull/8314/files#diff-bb8ee5bb0761c7423d34995edf5470ad459baa28266d730cbad6080a05f05893
array.rs https://github.com/RustPython/RustPython/pull/8314/files#diff-1e6ef8a4a7706885a4b2f08152c3a0298bf0db75e092d52708b08caa6726d321
function.rs https://github.com/RustPython/RustPython/pull/8314/files#diff-d4cf72f95963a6d3e08f9e7e53594d6b5e2cc7711afbc0b490894d97dc8d8648
thread.rs https://github.com/RustPython/RustPython/pull/8314/files#diff-0bfe10fdb30f1f6c60e31b36e738b86cd68863aeb8113c4c1eadec33e90caf8d
stdlib_ctypes.py https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
.github/workflows/ci.yamlhttps://github.com/RustPython/RustPython/pull/8314/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/.github/workflows/ci.yaml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
https://github.com/RustPython/RustPython/pull/8314/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
https://github.com/RustPython/RustPython/pull/8314/files#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133dd
crates/capi/src/pystate.rshttps://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/crates/capi/src/pystate.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
https://github.com/RustPython/RustPython/pull/8314/files#diff-91ad907d67bdcddff34fdea7b99464a162d6c314d66bd7a2a7bd2adbb2ff5bd2
crates/stdlib/src/overlapped.rshttps://github.com/RustPython/RustPython/pull/8314/files#diff-bb8ee5bb0761c7423d34995edf5470ad459baa28266d730cbad6080a05f05893
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/crates/stdlib/src/overlapped.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-bb8ee5bb0761c7423d34995edf5470ad459baa28266d730cbad6080a05f05893
https://github.com/RustPython/RustPython/pull/8314/files#diff-bb8ee5bb0761c7423d34995edf5470ad459baa28266d730cbad6080a05f05893
crates/vm/src/stdlib/_ctypes/array.rshttps://github.com/RustPython/RustPython/pull/8314/files#diff-1e6ef8a4a7706885a4b2f08152c3a0298bf0db75e092d52708b08caa6726d321
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/crates/vm/src/stdlib/_ctypes/array.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-1e6ef8a4a7706885a4b2f08152c3a0298bf0db75e092d52708b08caa6726d321
https://github.com/RustPython/RustPython/pull/8314/files#diff-1e6ef8a4a7706885a4b2f08152c3a0298bf0db75e092d52708b08caa6726d321
https://github.com/RustPython/RustPython/pull/8314/files#diff-1e6ef8a4a7706885a4b2f08152c3a0298bf0db75e092d52708b08caa6726d321
crates/vm/src/stdlib/_ctypes/function.rshttps://github.com/RustPython/RustPython/pull/8314/files#diff-d4cf72f95963a6d3e08f9e7e53594d6b5e2cc7711afbc0b490894d97dc8d8648
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/crates/vm/src/stdlib/_ctypes/function.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-d4cf72f95963a6d3e08f9e7e53594d6b5e2cc7711afbc0b490894d97dc8d8648
https://github.com/RustPython/RustPython/pull/8314/files#diff-d4cf72f95963a6d3e08f9e7e53594d6b5e2cc7711afbc0b490894d97dc8d8648
crates/vm/src/vm/thread.rshttps://github.com/RustPython/RustPython/pull/8314/files#diff-0bfe10fdb30f1f6c60e31b36e738b86cd68863aeb8113c4c1eadec33e90caf8d
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/crates/vm/src/vm/thread.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-0bfe10fdb30f1f6c60e31b36e738b86cd68863aeb8113c4c1eadec33e90caf8d
coderabbitaihttps://github.com/apps/coderabbitai
Jul 19, 2026https://github.com/RustPython/RustPython/pull/8314/files#r3609801236
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
https://github.com/RustPython/RustPython/pull/8314/files#diff-0bfe10fdb30f1f6c60e31b36e738b86cd68863aeb8113c4c1eadec33e90caf8d
extra_tests/snippets/stdlib_ctypes.pyhttps://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
View file https://github.com/youknowone/RustPython/blob/c200885bad48b7c7dacb03ed47faa9462f7c9576/extra_tests/snippets/stdlib_ctypes.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/RustPython/RustPython/pull/8314/{{ revealButtonHref }}
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
https://github.com/RustPython/RustPython/pull/8314/files#diff-7cfa080a4c0c0eac19bf2bd0eea152938488bab4c8a8d1b1d7bbc14bce41a61c
Please reload this pagehttps://github.com/RustPython/RustPython/pull/8314/files
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.