turtle: TNavigator.degrees(0) raises ZeroDivisionError instead of a clear error
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 77.2k
- フォーク
- 35.9k
- PR マージ指標
- PR 指標を取得中
説明
Bug report
turtle.TNavigator.degrees(fullcircle) — the public Turtle.degrees / turtle.degrees — divides
360 / fullcircle in _setDegreesPerAU without checking fullcircle, so passing 0 raises a
ZeroDivisionError that leaks the implementation rather than reporting the invalid argument:
>>> import turtle
>>> turtle.TNavigator().degrees(0)
Traceback (most recent call last):
...
ZeroDivisionError: division by zero
degrees documents fullcircle only as "a number", and 0 reaches the division directly through the
public API. It should raise a clear ValueError instead. The companion radians() passes math.tau,
so it is unaffected.
CPython versions tested on:
3.12, 3.14 (main)
Operating systems tested on:
Linux
Linked PRs
- gh-152038
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
turtle.TNavigator.degrees と、レポートで説明されている _setDegreesPerAU の経路から始め、続いて提供されている turtle.TNavigator().degrees(0) の再現を実行します。完了条件は、公開されている degrees API を通じてゼロが ZeroDivisionError ではなく明確な ValueError として拒否されることです。対応する radians() の動作に影響がないことを確認してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- api
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 30/100