Harden Python preview collection, lifetime, interface, and async safety - #198
Open
leileizhang (lei9444) wants to merge 9 commits into
Open
leileizhang (lei9444) wants to merge 9 commits into
leileizhang (lei9444) wants to merge 9 commits into
Conversation
Validate the receiver's stock runtime-class contract before JSON value writes, preflight bulk mutations, and keep custom generic collections nullable. Narrow verified stock class stubs and test real native behavior and strict consumers. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Register owned native results at Python return boundaries so a closing scope releases raw values before apartment teardown, while preserving borrowed sources, scalar results, callback thread affinity, and released-value errors. Reproduce and guard the shutdown crash in subprocesses. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
QueryInterface-check standalone constructors before retaining or caching a pointer, preserve borrowed constructor sources on cache hits, and fail closed for unknown IIDs. Keep generic and observable projections safe with real WinRT and strict typing regressions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Require an Object before call_0/call_1 can prepare or dispatch a caller-specified native signature. Exercise pre-dispatch rejection and valid IID-cast low-level calls in an isolated Python process. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Observe raw outputs weakly so temporary casts and callback inputs drop without accumulating native references; keep projected wrappers strongly tracked and release surviving raw owners before apartment shutdown. Refresh seven generated Python snapshots for the interface-IID constructor change. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Mixed-language test coverageWorkflow status: ✅ Passed
|
Match ProjectedLifetimeScope.track_native in the packaged Python stub and test the installed wheel surface, fixing hosted mypy.stubtest parity without changing native lifetime behavior. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Match DynWinRTValue's owned-reference drop in the projection-only test double and accept the checked-constructor cache argument. Assert that an unconsumed temporary returns the native owner's reference count to baseline. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Make stock JsonArray/JsonObject runtime method inputs non-null in both normal and --no-pyi output, keeping generic IVector/IMap<IJsonValue> nullable. Verify generated source and inspect.signature contracts without changing JS/TS projections. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Weakly track independent DynWinRTArray and DynWinRTStruct owners at creation, extraction, and nested-field boundaries. Deterministically release surviving COM references at scope exit, reject all post-release access, and leave scalar containers live. Cover five previously crashing subprocess paths, nested arrays, and native reference balance. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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
IJsonValueinputs before mutating stockJsonArray/JsonObject(including raw arrays, slices, updates, and generic interface views), while preserving native nulls in custom generic collections. Stock-class stubs and generated runtime annotations, including--no-pyi, now describe the non-null input contract.DynWinRTArrayandDynWinRTStructcontainers are also weakly observed at creation/extraction, released before apartment teardown, and fail explicitly on use after release. Scalar containers remain usable; native reference ownership and callback affinity are preserved.IBuffer(uri._obj)now fails withE_NOINTERFACEwithout consuming its source.DynWinRTValue.call_0/call_1native dispatch (Reject Async receivers in low-level Python call_0/call_1 before vtable dispatch #196).ProjectedLifetimeScope.track_nativestub parity (commit 6), projection-only COM-drop fixture correction (commit 7), stock JSON runtime/--no-pyiannotations (commit 8), and independent array/struct COM-owner cleanup (commit 9). All changes are additive; no published history was rewritten.Validation
0xC0000005) and two native reference-balance failures. Afterward, direct, extracted and nested COM containers exit cleanly, native owners close at scope exit, scalar containers remain live, and released-container operations raise. The complete Python binding suite passes (14 optional WinUI fixture skips).mypy.stubtest,--no-pyi/inspect.signature, JS/TS snapshots and declaration typechecks pass.cargo fmt --all --checkandgit diff --checkpass.No release pipeline, XML DOM nullability, or published preview.22 release-note changes are included.