python / python/cpython

`asyncio.Timeout.__aexit__` does not handle `BaseExceptionGroup`

オープン
#137,549 コメント 2 件 リアクション 0 件 担当者 2 名 GitHub で見る

@gunyu1019 がすでに取り組んでいます。

2025年8月15日 から。

stdlib topic-asyncio type-bug
主要言語
Python
スター
77.2k
フォーク
35.9k
PR マージ指標
PR 指標を取得中

説明

Bug report

Bug description:

There may be a good reason for this I am not seeing, but in the asyncio.Timeout.__aexit__ handler, the exception group handling seems too narrow:

https://github.com/python/cpython/blob/9743d069bd53e9d3a8f09df899ec1c906a79da24/Lib/asyncio/timeouts.py#L113-L119

Given exc_val itself can be a BaseException and _insert_timeout_error takes a BaseException as an argument, I fail to see a reason not to check for superclass BaseExceptionGroup instead.

https://github.com/python/cpython/blob/9743d069bd53e9d3a8f09df899ec1c906a79da24/Lib/asyncio/timeouts.py#L133

This no longer impacts me as I implemented what I was aiming for in a better way, but it still looks like a bug. Is it?

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs
  • gh-137797

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。