summaryrefslogtreecommitdiff
path: root/lib/testtools/testtools/_compat3x.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/testtools/testtools/_compat3x.py')
-rw-r--r--lib/testtools/testtools/_compat3x.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/testtools/testtools/_compat3x.py b/lib/testtools/testtools/_compat3x.py
new file mode 100644
index 0000000000..f3d569662d
--- /dev/null
+++ b/lib/testtools/testtools/_compat3x.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2011 testtools developers. See LICENSE for details.
+
+"""Compatibility helpers that are valid syntax in Python 3.x.
+
+Only add things here if they *only* work in Python 3.x or are Python 3
+alternatives to things that *only* work in Python 2.x.
+"""
+
+__all__ = [
+ 'reraise',
+ ]
+
+
+def reraise(exc_class, exc_obj, exc_tb, _marker=object()):
+ """Re-raise an exception received from sys.exc_info() or similar."""
+ raise exc_class(*exc_obj.args).with_traceback(exc_tb)
+