From 893598d266c5be0ae6af82fc85afab5e7af06ef8 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 6 Mar 2014 20:21:16 -0800 Subject: [PATCH] irkerd: Convert to Python 3's "except x as y" syntax Support for this was added in Python 2.6 and 3.0. We can't have Python 3 compatibility without removing the old "except x, y" syntax, and I think 3.x support is more imporant than 2.5 support. In any case, the existing irkerd has been using the new syntax since 3cc8751 (Truncate messages that are longer than 512 bytes and catch any exceptions irclib throws about rejected messages, 2013-01-21), so this commit is not a *new* break with 2.5 support. --- irkerd | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/irkerd b/irkerd index a84d265..71a8c10 100755 --- a/irkerd +++ b/irkerd @@ -17,7 +17,6 @@ resource page at . Requires Python 2.7, or: * 2.6 with the argparse package installed. -* 2.5 with the argparse and simplejson packages installed. """ from __future__ import with_statement @@ -580,7 +579,7 @@ class Connection: LOG.error( "We're expired but still running! This is a bug.") break - except Exception, e: + except Exception as e: LOG.error("exception %s in thread for %s" % (e, self.target)) # Maybe this should have its own status? self.status = "expired" @@ -816,7 +815,7 @@ class Irker: url) target = Target(url) target.validate() - except InvalidRequest, e: + except InvalidRequest as e: LOG.error(str(e)) else: targets.append(target) @@ -853,7 +852,7 @@ class Irker: self.servers.keys(), key=lambda name: self.servers[name].last_xmit()) del self.servers[oldest] - except InvalidRequest, e: + except InvalidRequest as e: LOG.error(str(e)) except ValueError: self.logerr("can't recognize JSON on input: %r" % line) @@ -928,7 +927,7 @@ if __name__ == '__main__': signal.pause() except KeyboardInterrupt: raise SystemExit(1) - except socket.error, e: + except socket.error as e: LOG.error("server launch failed: %r\n" % e) # end -- 2.26.2