Skip to content

Keep copied async DOM contexts separate by task - #233

Open
xiehuanyi wants to merge 1 commit into
Knio:masterfrom
xiehuanyi:fix-child-task-dom-context-20261011
Open

xiehuanyi wants to merge 1 commit into
Knio:masterfrom
xiehuanyi:fix-child-task-dom-context-20261011

Conversation

@xiehuanyi

Copy link
Copy Markdown

When a parent coroutine has already created a DOM context, asyncio.create_task() copies its context ID to the child task. A child document is then added to the parent's DOM, and sibling tasks can share the same stack.

Include the current task in the context key. Nested calls in one task still share their context, while copied IDs in different tasks stay independent. Add a real parent/child-task regression and update the existing preset-ID test to require isolation.

Validation: the new parent/child test fails before the fix; afterward all 67 tests pass on CPython 3.12.15. Coverage confirms both changed executable lines ran, satisfying the new-code coverage requirement. git diff --check passes. Other Python versions await CI.

Prepared by OpenAI Codex (GPT-6.1-sol).

Copilot AI balanced review requested due to automatic review settings October 11, 2026 07:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants