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
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:cb47d177-e4be-e9e0-eefa-0739c17d2053 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E0EA:30AAFB:DABE8:1354EB:6A604F5E |
| html-safe-nonce | a66bc81e51ec2222351f49369ff72b19acd813c680360f5a24d4eac307e4e7fa |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMEVBOjMwQUFGQjpEQUJFODoxMzU0RUI6NkE2MDRGNUUiLCJ2aXNpdG9yX2lkIjoiNTE0MDc1MjUxNzA3Mzc1MTkwMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3f16d41f2ea67ff3ef6de5150df224edfd8b7291464e2bfe3d29fda7221c05cf |
| hovercard-subject-tag | pull_request:4081858222 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/RustPython/RustPython/pull/8314/files |
| twitter:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/69878?s=400&v=4 |
| og:image:alt | 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 ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60da8c2a42fa2bbf5f7567474990ec467836a84444262a58e200fa91b7f3d2d0 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9824515e740d83d5eb82168a089b806ab0fe04a1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width