Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: fix_encoding.py

Issue 1710553003: Convert old-style exception handling to current format in fix_encoding.py. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fix_encoding.py
diff --git a/fix_encoding.py b/fix_encoding.py
index 5da9135818d4c3cb71d09c7dd02441340205aaf1..c331820096b91cc5964fa9bf49fe3b24fe99fb5e 100644
--- a/fix_encoding.py
+++ b/fix_encoding.py
@@ -171,7 +171,7 @@ class WinUnicodeOutputBase(object):
try:
for line in lines:
self.write(line)
- except Exception, e:
+ except Exception as e:
complain('%s.writelines: %r' % (self.name, e))
raise
@@ -230,7 +230,7 @@ class WinUnicodeConsoleOutput(WinUnicodeOutputBase):
if not remaining:
break
text = text[int(n.value):]
- except Exception, e:
+ except Exception as e:
complain('%s.write: %r' % (self.name, e))
raise
@@ -253,7 +253,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
def flush(self):
try:
self._stream.flush()
- except Exception, e:
+ except Exception as e:
complain('%s.flush: %r from %r' % (self.name, e, self._stream))
raise
@@ -263,7 +263,7 @@ class WinUnicodeOutput(WinUnicodeOutputBase):
# Replace characters that cannot be printed instead of failing.
text = text.encode(self.encoding, 'replace')
self._stream.write(text)
- except Exception, e:
+ except Exception as e:
complain('%s.write: %r' % (self.name, e))
raise
@@ -348,7 +348,7 @@ def fix_win_console(encoding):
# TODO(maruel): Do sys.stdin with ReadConsoleW(). Albeit the limitation is
# "It doesn't appear to be possible to read Unicode characters in UTF-8
# mode" and this appears to be a limitation of cmd.exe.
- except Exception, e:
+ except Exception as e:
complain('exception %r while fixing up sys.stdout and sys.stderr' % e)
return True
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698