Skip to content

fix: handle cancellation in async event predicates - #3380

Draft
himanshug189-sketch wants to merge 1 commit into
microsoft:mainfrom
himanshug189-sketch:fix-async-predicate-cancelled-error
Draft

himanshug189-sketch wants to merge 1 commit into
microsoft:mainfrom
himanshug189-sketch:fix-async-predicate-cancelled-error

Conversation

@himanshug189-sketch

Copy link
Copy Markdown

Summary

  • Handle asyncio.CancelledError explicitly in the async event-predicate continuation.
  • Remove the event listener and settle the waiting promise with the cancellation before re-raising it, preventing the event waiter from remaining pending.
  • Add a regression test covering cancellation through page.expect_response().

Fixes #3379

Tests

  • Focused regression test: 3 passed (Chromium, Firefox, WebKit).
  • Complete tests/async/python/test_page.py: 27 passed.
  • mypy playwright/_impl/waiter.py: passed.
  • git diff --check: passed.

Note: Running mypy on both changed files also reports an existing type error in tests/server.py:323. The modified implementation file passes independently.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

This branch has not been deployed

No deployments
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.

[Bug]: Async event predicate raising CancelledError leaves the event waiter pending

2 participants