Package: python-retrying / 1.2.3-2

six.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Description: Remove six copying and use six directly.
Author: Chuck Short <zulcss@ubuntu.com>
Forwarded: Not yet
Last-Update: 2014-09-30

Index: python-retrying/retrying.py
===================================================================
--- python-retrying.orig/retrying.py
+++ python-retrying/retrying.py
@@ -40,31 +40,7 @@ import sys
 import time
 import traceback
 
-# Python 3 compatibility hacks, pilfered from https://pypi.python.org/pypi/six/1.6.1
-PY3 = sys.version_info[0] == 3
-if PY3:
-    def reraise(tp, value, tb=None):
-        if value.__traceback__ is not tb:
-            raise value.with_traceback(tb)
-        raise value
-
-else:
-    def exec_(_code_, _globs_=None, _locs_=None):
-        """Execute code in a namespace."""
-        if _globs_ is None:
-            frame = sys._getframe(1)
-            _globs_ = frame.f_globals
-            if _locs_ is None:
-                _locs_ = frame.f_locals
-            del frame
-        elif _locs_ is None:
-            _locs_ = _globs_
-        exec("""exec _code_ in _globs_, _locs_""")
-
-
-    exec_("""def reraise(tp, value, tb=None):
-    raise tp, value, tb
-""")
+import six
 
 # sys.maxint / 2, since Python 3.2 doesn't have a sys.maxint...
 MAX_WAIT = 1073741823
@@ -282,7 +258,7 @@ class Attempt(object):
             if wrap_exception:
                 raise RetryError(self)
             else:
-                reraise(self.value[0], self.value[1], self.value[2])
+                six.reraise(self.value[0], self.value[1], self.value[2])
         else:
             return self.value