Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

About checking for CancelledError and its subclasses #113848

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

For long time I wanted to replace the use ofPyObject_IsInstance() withCancelledError in_asynciomodule.c. Even if the C code is correct and is closest to the corresponding Python code, it looked unnecessary complicated and bugprone. Also,PyErr_GivenExceptionMatches() is used inexcept implementation, so it may be more correct than an isinstance check. But I did not have tests for CancelledError subclasses which would show the difference.

Other issue.@gvanrossumnoticed thatasyncio.timeout() only checks for exact CancelledError, and not its subclasses.asyncio.TaskGroup() also only checks for exact CancelledError. It is suspicious, because all other code (except_convert_future_exc() infutures.py) treats CancelledError subclasses in the same way as CancelledError.asyncio.timeout() andasyncio.TaskGroup() were added recently, so perhaps it is error in their implementation. On other hand, I do not know any use case for CancelledError subclasses.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp