summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Cardona <remi.cardona@free.fr>2014-07-15 00:36:35 +0200
committerRémi Cardona <remi.cardona@free.fr>2014-07-15 00:36:35 +0200
commitac2d15727c079fbc1d3fe6a606feef9c1179d2ce (patch)
tree5a2d0d56422e98f0c25c762e7c5cc105848a9857
parentca25a55a1093de0a59a618fe33e6aa3f013e7d24 (diff)
downloadlogilab-common-ac2d15727c079fbc1d3fe6a606feef9c1179d2ce.tar.gz
[py3k] Fix raise with embedded traceback
python 3 removed the raise syntax with 3 expressions.
-rw-r--r--registry.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/registry.py b/registry.py
index 689f1f1..24b5a78 100644
--- a/registry.py
+++ b/registry.py
@@ -248,7 +248,9 @@ class Registry(dict):
try:
return super(Registry, self).__getitem__(name)
except KeyError:
- raise ObjectNotFound(name), None, sys.exc_info()[-1]
+ exc = ObjectNotFound(name)
+ exc.__traceback__ = sys.exc_info()[-1]
+ raise exc
@classmethod
def objid(cls, obj):
@@ -555,7 +557,9 @@ class RegistryStore(dict):
try:
return super(RegistryStore, self).__getitem__(name)
except KeyError:
- raise RegistryNotFound(name), None, sys.exc_info()[-1]
+ exc = RegistryNotFound(name)
+ exc.__traceback__ = sys.exc_info()[-1]
+ raise exc
# methods for explicit (un)registration ###################################