Repository navigation
Fix Python lifetime scope thread affinity - #134
Merged
Merged
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mixed-language test coverageWorkflow status: ✅ Passed
|
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 778823b5-9f70-4a61-95a9-19e3d37f95e9
Shawn Yuan (shuaiyuanxx)
approved these changes
Sep 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ProjectedLifetimeScopecapture its owner thread and reject foreign-thread enter, tracking, and close operations before registry mutation or native releaseContextVarreplay so same-thread callbacks retain the captured active scope, while foreign-thread callbacks mask only that inherited lifetime scopeDynWinRTValue.on_progress()handlers, and agileDynWinRtElementFactoryget/recycle callbacks; preserve original callbacks as unraisable error targets and keep element return cast ownership unchangedasyncio.to_thread, copied contexts, manual foreign-thread operations, retained/unretained delegate values, real native HTTP progress, and foreign-thread element-factory get/recycle behaviorValidation
cargo fmt --allandcargo fmt --all -- --checkcargo test -p dynwinrt-py --quiet— 5 passedcargo test -p dynwinrt-codegen --quiet— full suite passedpython -m maturin build --releaseand wheel reinstall — CPython 3.13 ARM64 wheel builtpython -m pytest bindings\py\tests -q— 151 passed, including real HTTP progress and direct agile element-factory cross-thread regressionspython -m mypy.stubtest dynwinrt --allowlist bindings\py\stubtest_allowlist.txt --ignore-disjoint-bases— passed.\tests\e2e\e2e_test.ps1 -SkipBuild -Lang py— strict mypy passed; Python WinRT E2E 42/42 passedUIElementmodule lacksIID_IUIElement; the existing runner reports that callback exception throughsys.unraisablehookwhile returning exit code 0, before element-factory coverage begins