typing._allow_reckless_class_checks doesn't work when _abc doesn't exist.
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 36k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
Bug description:
When typing._caller's sys._getframe fallback is triggered without _abc module, _typing._allow_reckless_class_checks fails to check _py_abc while running abc.ABCMeta.__instancecheck__.
Without _abc module, _typing._allow_reckless_class_checksfails to check _py_abc
Related code in typing.py:
https://github.com/python/cpython/blob/v3.14.0b3/Lib/typing.py#L1846-L1863
This is technically a bug of typing.py, but really hard to be triggered on CPython.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Solution suggestion
Patch typing._allow_reckless_class_checks to also check _py_abc
This is the most conservative approach. Compatible with all of previous scenarios and additionally fixing the bug.
Patch typing._caller to remove sys._getframe or raise warning when fallback
If the the typing requires to work with sys._getframemodulename, then let the users to know it has a caveat.
Linked PRs
- gh-136115
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
Lib/typing.py の1846-1863行目を読み、提案された変更をリンク先の PR gh-136115 と比較してください。_abc が利用できない場合にも _allow_reckless_class_checks が _py_abc を処理し、CPython の main ブランチで動作が検証されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 25/100