| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -179,7 +179,7 @@ def config_dict(filename): | |||
| 179 | 179 | continue | |
| 180 | 180 | try: | |
| 181 | 181 | key, value = line.split("=") | |
| 182 | - except: | ||
| 182 | + except ValueError: | ||
| 183 | 183 | print("Bad line in config-file %s:\n%s" % (filename,line)) | |
| 184 | 184 | continue | |
| 185 | 185 | key = key.strip() | |
@@ -192,7 +192,7 @@ def config_dict(filename): | |||
| 192 | 192 | value = float(value) | |
| 193 | 193 | else: | |
| 194 | 194 | value = int(value) | |
| 195 | - except: | ||
| 195 | + except ValueError: | ||
| 196 | 196 | pass # value need not be converted | |
| 197 | 197 | cfgdict[key] = value | |
| 198 | 198 | return cfgdict | |
@@ -220,7 +220,7 @@ def readconfig(cfgdict): | |||
| 220 | 220 | try: | |
| 221 | 221 | head, tail = split(__file__) | |
| 222 | 222 | cfg_file2 = join(head, default_cfg) | |
| 223 | - except: | ||
| 223 | + except Exception: | ||
| 224 | 224 | cfg_file2 = "" | |
| 225 | 225 | if isfile(cfg_file2): | |
| 226 | 226 | cfgdict2 = config_dict(cfg_file2) | |
@@ -229,7 +229,7 @@ def readconfig(cfgdict): | |||
| 229 | 229 | ||
| 230 | 230 | try: | |
| 231 | 231 | readconfig(_CFG) | |
| 232 | - except: | ||
| 232 | + except Exception: | ||
| 233 | 233 | print ("No configfile read, reason unknown") | |
| 234 | 234 | ||
| 235 | 235 | ||
@@ -653,7 +653,7 @@ def eventfun(event): | |||
| 653 | 653 | x, y = (self.cv.canvasx(event.x)/self.xscale, | |
| 654 | 654 | -self.cv.canvasy(event.y)/self.yscale) | |
| 655 | 655 | fun(x, y) | |
| 656 | - except: | ||
| 656 | + except Exception: | ||
| 657 | 657 | pass | |
| 658 | 658 | self.cv.tag_bind(item, "<Button%s-Motion>" % num, eventfun, add) | |
| 659 | 659 | ||
@@ -1158,7 +1158,7 @@ def _colorstr(self, color): | |||
| 1158 | 1158 | raise TurtleGraphicsError("bad color string: %s" % str(color)) | |
| 1159 | 1159 | try: | |
| 1160 | 1160 | r, g, b = color | |
| 1161 | - except: | ||
| 1161 | + except (TypeError, ValueError): | ||
| 1162 | 1162 | raise TurtleGraphicsError("bad color arguments: %s" % str(color)) | |
| 1163 | 1163 | if self._colormode == 1.0: | |
| 1164 | 1164 | r, g, b = [round(255.0*x) for x in (r, g, b)] | |
@@ -2702,7 +2702,7 @@ def _cc(self, args): | |||
| 2702 | 2702 | return args | |
| 2703 | 2703 | try: | |
| 2704 | 2704 | r, g, b = args | |
| 2705 | - except: | ||
| 2705 | + except (TypeError, ValueError): | ||
| 2706 | 2706 | raise TurtleGraphicsError("bad color arguments: %s" % str(args)) | |
| 2707 | 2707 | if self.screen._colormode == 1.0: | |
| 2708 | 2708 | r, g, b = [round(255.0*x) for x in (r, g, b)] | |
@@ -3865,7 +3865,7 @@ def read_docstrings(lang): | |||
| 3865 | 3865 | try: | |
| 3866 | 3866 | # eval(key).im_func.__doc__ = docsdict[key] | |
| 3867 | 3867 | eval(key).__doc__ = docsdict[key] | |
| 3868 | - except: | ||
| 3868 | + except Exception: | ||
| 3869 | 3869 | print("Bad docstring-entry: %s" % key) | |
| 3870 | 3870 | ||
| 3871 | 3871 | _LANGUAGE = _CFG["language"] | |
@@ -3875,7 +3875,7 @@ def read_docstrings(lang): | |||
| 3875 | 3875 | read_docstrings(_LANGUAGE) | |
| 3876 | 3876 | except ImportError: | |
| 3877 | 3877 | print("Cannot find docsdict for", _LANGUAGE) | |
| 3878 | - except: | ||
| 3878 | + except Exception: | ||
| 3879 | 3879 | print ("Unknown Error when trying to import %s-docstring-dictionary" % | |
| 3880 | 3880 | _LANGUAGE) | |
| 3881 | 3881 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1655,6 +1655,7 @@ Uwe Zessin | |||
| 1655 | 1655 | Cheng Zhang | |
| 1656 | 1656 | Kai Zhu | |
| 1657 | 1657 | Tarek Ziadé | |
| 1658 | + Jelle Zijlstra | ||
| 1658 | 1659 | Gennadiy Zlobin | |
| 1659 | 1660 | Doug Zongker | |
| 1660 | 1661 | Peter Åstrand | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,6 +13,9 @@ Core and Builtins | |||
| 13 | 13 | Library | |
| 14 | 14 | ------- | |
| 15 | 15 | ||
| 16 | + - Issue #27238: Got rid of bare excepts in the turtle module. Original patch | ||
| 17 | + by Jelle Zijlstra. | ||
| 18 | + | ||
| 16 | 19 | - Issue #27122: When an exception is raised within the context being managed | |
| 17 | 20 | by a contextlib.ExitStack() and one of the exit stack generators | |
| 18 | 21 | catches and raises it in a chain, do not re-raise the original exception | |
| Back | FazBrowse Home | New Git URL |
0 commit comments