1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-07-30 23:41:52 +03:00

override: Fix exception handling syntax

Python 3 no longer accepts 'except Exception, e:' as valid while Python
2.4 does not accept the new syntax 'except Exception as e:' so this uses
a fall back method that is compatible with both.
This commit is contained in:
Doug Goldstein
2013-12-06 16:22:39 -06:00
parent c2da294180
commit bf9bc81447
2 changed files with 8 additions and 3 deletions

View File

@ -50,7 +50,8 @@
ret = handler(self, got, opaque)
if type(ret) is int and ret < 0:
raise RuntimeError("recvAll handler returned %d" % ret)
except Exception, e:
except Exception:
e = sys.exc_info()[1]
try:
self.abort()
except: