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
Bug report
turtle.TNavigator.degrees(fullcircle)— the publicTurtle.degrees/turtle.degrees— divides360 / fullcirclein_setDegreesPerAUwithout checkingfullcircle, so passing0raises aZeroDivisionErrorthat leaks the implementation rather than reporting the invalid argument:degreesdocuments fullcircle only as "a number", and0reaches the division directly through thepublic API. It should raise a clear
ValueErrorinstead. The companionradians()passesmath.tau,so it is unaffected.
CPython versions tested on:
3.12, 3.14 (main)
Operating systems tested on:
Linux
Linked PRs