Title: Update asyncio transport fixes and tests to CPython 3.15.2 by youknowdot · Pull Request #9878 · RustPython/RustPython · GitHub
Open Graph Title: Update asyncio transport fixes and tests to CPython 3.15.2 by youknowdot · Pull Request #9878 · RustPython/RustPython
X Title: Update asyncio transport fixes and tests to CPython 3.15.2 by youknowdot · Pull Request #9878 · RustPython/RustPython
Description: Summary Use scripts/update_lib migrate to update a coherent asyncio transport group from official CPython v3.15.2 (5e58eaad7c58df58dfa8ea549c87996e01dd1077): Flush and recover queued proactor datagrams correctly around close, abort and protocol callbacks; report Windows unreachable-port errors instead of silently swallowing them. Preserve TLS shutdown deadlines through transport close, release failed-connection waiter references, and close streams when the connection callback raises. Clear the selector read callback on connection loss and handle stopped-child notifications during macOS waitid polling. Bring the corresponding canonical event/socket/TLS/stream/subprocess tests together. Seven implementation files and five test files match the tag byte-for-byte. test_subprocess.py differs only by its pre-existing Windows flaky-test skip, preserved by update_lib. Existing RustPython follow-up changes in asyncio/tasks.py and asyncio/tools.py remain untouched. No assertions were locally rewritten and no new skip/expectedFailure marker was added. Initial validation and limits Actual RustPython interpreter: main 4045401e plus the independent ElementTree patch from #9874, using this worktree's Lib through RUSTPYTHONPATH. The initial Python-only commit had no dependency on that patch. The native correction below now accompanies this update. -m test ran subprocess (86 tests), proactor mocks (82), selector events (131), transport (7), SSL (24) and SSL protocol (40): 370 tests reported, 72 skipped, 298 actually executed and passed. 64 SSL tests skipped because the local verification binary lacks _ssl; 8 additional platform/capability skips remain. Four other requested modules (test_events, test_sock_lowlevel, test_streams, test_base_events) were blocked at import because this environment denies AF_UNIX socket creation with EPERM. The same restriction was independently reproduced in host CPython. These runs are not counted as passing. Actual Windows proactor IO and macOS waitid behavior are not locally executed. Platform CI must validate them, along with SSL/network coverage. Syntax checks, diff checks, normal repository hooks, and independent source review passed. Full workspace/C-API tests and performance benchmarks were not run locally. Based directly on main, independent of the other open PRs. Native TLS lifetime correction (61aff9a) The new canonical no-cycle tests exposed a rustls backend lifetime bug: after a fatal alert had been fully sent, the backend still held the same Python exception it raised. Its traceback could retain SSLProtocol and the closed transport. A terminal Failed state now releases that saved exception after output succeeds, while preserving the original error across blocked, partial, or failed alert-output retries. Subsequent handshake attempts report EOF, matching the CPython 3.15.2 reference. No canonical test body or marker was changed. Fresh local verification used this PR's native code and Lib, built with rustls/AWS-LC and Unicode 3.2 support: Both canonical failed-certificate no-cycle tests reproduced on the baseline and passed after the fix. Both also passed on CPython 3.15.2. Full test_asyncio.test_sslproto, test_ssl.SSLObjectTests, and three threaded SNI-error tests: 49 reported, 13 Windows-only skips, 36 actually executed and passed. Adjacent canonical test_asyncio.test_ssl: 24 reported, 2 skips, 22 actually executed and passed. Separate diagnostic fault injection verified would-block, zero-write, and OSError output failures, one-byte partial retries, reentrant handshake rejection, and exactly-once fatal-alert delivery. These diagnostics were not added as project-specific tests. Repeated handshake/read/write and unwrap failure categories were compared with CPython 3.15.2. This is not a claim of complete SSL parity. Normal commit hooks and cargo fmt passed. Full workspace/C-API tests, Clippy, Windows/macOS execution, and performance measurements were not run locally; fresh head CI remains pending. TLS review follow-up (4b5cc28) Treat an initialization failure that has already finished sending its fatal alert as handled. This prevents a second generic alert and avoids masking the original TLS error with a second output failure. One directly related regression was added to the existing SSL snippet; no canonical CPython test was weakened or skipped. The TLS 1.2-client / TLS 1.3-only-server reproduction failed before the correction (two alerts), and passes afterward (one protocol-version alert). The same snippet passes on CPython 3.15.2. Diagnostic second-write fault injection now preserves the original TLS error without a second write; blocked/zero-write/OSError alert retry diagnostics also passed. Rebuilt exact native candidate: focused SSL suite 49 reported, 36 passed, 13 Windows-only skips. The complete existing stdlib_ssl.py snippet passed. Normal hooks and formatting passed. This checks alert delivery and error preservation, not complete error-message parity: the pre-existing rustls protocol-version mismatch error classification still differs from CPython. No new performance measurement or local Windows/macOS execution was performed. New-head CI remains pending. The previous Windows run passed test_asyncio.test_events; the reported synchronous oversized-UDP scenario is also reproducible in CPython's canonical test under fault injection, so its assertions and markers remain unchanged. Summary by CodeRabbit Bug Fixes Improved handling of TLS handshake failures. Clients now receive a single alert when a server handshake fails, and the original handshake error is reported after the alert is sent. If sending the alert fails temporarily, the error is retained while the send is retried. Subsequent attempts after a terminal handshake failure return an SSL EOF error.
Open Graph Description: Summary Use scripts/update_lib migrate to update a coherent asyncio transport group from official CPython v3.15.2 (5e58eaad7c58df58dfa8ea549c87996e01dd1077): Flush and recover queued proactor data...
X Description: Summary Use scripts/update_lib migrate to update a coherent asyncio transport group from official CPython v3.15.2 (5e58eaad7c58df58dfa8ea549c87996e01dd1077): Flush and recover queued proactor data...
Opengraph URL: https://github.com/RustPython/RustPython/pull/9878
X: @github
Domain: github.com
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:f06d99c1-f3e3-1014-c143-d94d3cf63a1c |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9AEE:29FFA9:35758F8:43B6EF2:6B01DE83 |
| html-safe-nonce | 83616038ba137152a7a8768d173543eede92c54bbd0744900c46b0349c113262 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QUVFOjI5RkZBOTozNTc1OEY4OjQzQjZFRjI6NkIwMURFODMiLCJ2aXNpdG9yX2lkIjoiMTY2MzY3Mjc4NTI0NDkwNTA5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8080564f0592b8af93e63adb86b4f1cb1178b924e8c03b5d441da00a46f1cbb8 |
| hovercard-subject-tag | pull_request:5337277679 |
| 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/9878/files |
| twitter:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/336763669?s=400&v=4 |
| og:image:alt | Summary Use scripts/update_lib migrate to update a coherent asyncio transport group from official CPython v3.15.2 (5e58eaad7c58df58dfa8ea549c87996e01dd1077): Flush and recover queued proactor data... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width