Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d7132eb

Browse files
committed
Don't create exception objects unless absolutely necessary -- they are much more expensive on Pyhton 3.x
1 parent 2f2ae95 commit d7132eb

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

lib/matplotlib/backends/backend_ps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1312,7 +1312,7 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble,
13121312
else:
13131313
try:
13141314
latexh.write(s)
1315-
except UnicodeEncodeError as err:
1315+
except UnicodeEncodeError:
13161316
verbose.report("You are using unicode and latex, but have "
13171317
"not enabled the matplotlib 'text.latex.unicode' "
13181318
"rcParam.", 'helpful')

lib/matplotlib/backends/tkagg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def blit(photoimage, aggimage, bbox=None, colormode=1):
1010
bbox_array = None
1111
try:
1212
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
13-
except Tk.TclError as v:
13+
except Tk.TclError:
1414
try:
1515
try:
1616
_tkagg.tkinit(tk.interpaddr(), 1)

lib/matplotlib/fontconfig_pattern.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def parse(self, pattern):
128128
try:
129129
self._parser.parseString(pattern)
130130
except self.ParseException as e:
131-
raise ValueError("Could not parse font string: '%s'\n%s" % (pattern, e))
131+
raise ValueError(
132+
"Could not parse font string: '%s'\n%s" % (pattern, e))
132133

133134
self._properties = None
134135

lib/matplotlib/ticker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def _formatSciNotation(self, s):
506506
else:
507507
s = ('%se%s%s' %(significand, sign, exponent)).rstrip('e')
508508
return s
509-
except IndexError as msg:
509+
except IndexError:
510510
return s
511511

512512

0 commit comments

Comments
 (0)