diff --git a/Lib/turtle.py b/Lib/turtle.py index b49df26bd07bc5a..f6e5f91c7385f48 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -1095,6 +1095,8 @@ def setworldcoordinates(self, llx, lly, urx, ury): self.mode("world") xspan = float(urx - llx) yspan = float(ury - lly) + if xspan == 0 or yspan == 0: + raise ValueError("Width and height must be greater than zero") wx, wy = self._window_size() self.screensize(wx-20, wy-20) oldxscale, oldyscale = self.xscale, self.yscale @@ -2055,6 +2057,8 @@ def circle(self, radius, extent = None, steps = None): if steps is None: frac = abs(extent)/self._fullcircle steps = 1+int(min(11+abs(radius)/6.0, 59.0)*frac) + if steps == 0: + raise ValueError("steps must not be zero") w = 1.0 * extent / steps w2 = 0.5 * w l = 2.0 * radius * math.sin(math.radians(w2)*self._degreesPerAU)