Skip to content

Commit b21aa62

Browse files
committed
Revert "Implement PEP3134 to discover underlying problems with python3 (aws#355)"
This reverts commit 4660169. Closes aws#370
1 parent 680c646 commit b21aa62

File tree

5 files changed

+15
-21
lines changed

5 files changed

+15
-21
lines changed

aws_xray_sdk/core/async_recorder.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import six
32

43
from aws_xray_sdk.core.recorder import AWSXRayRecorder
54
from aws_xray_sdk.core.utils import stacktrace
@@ -82,10 +81,10 @@ async def record_subsegment_async(self, wrapped, instance, args, kwargs, name,
8281
try:
8382
return_value = await wrapped(*args, **kwargs)
8483
return return_value
85-
except Exception as exc:
86-
exception = exc
84+
except Exception as e:
85+
exception = e
8786
stack = stacktrace.get_stacktrace(limit=self._max_trace_back)
88-
six.raise_from(exc, exc)
87+
raise
8988
finally:
9089
# No-op if subsegment is `None` due to `LOG_ERROR`.
9190
if subsegment is not None:

aws_xray_sdk/core/patcher.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import re
77
import sys
88
import wrapt
9-
import six
109

1110
from aws_xray_sdk import global_sdk_config
1211
from .utils.compat import PY2, is_classmethod, is_instance_method
@@ -110,9 +109,9 @@ def patch(modules_to_patch, raise_errors=True, ignore_module_patterns=None):
110109
def _patch_module(module_to_patch, raise_errors=True):
111110
try:
112111
_patch(module_to_patch)
113-
except Exception as exc:
112+
except Exception:
114113
if raise_errors:
115-
six.raise_from(exc, exc)
114+
raise
116115
log.debug('failed to patch module %s', module_to_patch)
117116

118117

aws_xray_sdk/core/recorder.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import os
55
import platform
66
import time
7-
import six
87

98
from aws_xray_sdk import global_sdk_config
109
from aws_xray_sdk.version import VERSION
@@ -456,10 +455,10 @@ def record_subsegment(self, wrapped, instance, args, kwargs, name,
456455
try:
457456
return_value = wrapped(*args, **kwargs)
458457
return return_value
459-
except Exception as exc:
460-
exception = exc
458+
except Exception as e:
459+
exception = e
461460
stack = stacktrace.get_stacktrace(limit=self.max_trace_back)
462-
six.raise_from(exc, exc)
461+
raise
463462
finally:
464463
# No-op if subsegment is `None` due to `LOG_ERROR`.
465464
if subsegment is not None:

aws_xray_sdk/ext/aiohttp/middleware.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import six
2-
31
"""
42
AioHttp Middleware
53
"""
@@ -66,14 +64,14 @@ async def middleware(request, handler):
6664
except HTTPException as exc:
6765
# Non 2XX responses are raised as HTTPExceptions
6866
response = exc
69-
six.raise_from(exc, exc)
70-
except BaseException as exc:
67+
raise
68+
except BaseException as err:
7169
# Store exception information including the stacktrace to the segment
7270
response = None
7371
segment.put_http_meta(http.STATUS, 500)
7472
stack = stacktrace.get_stacktrace(limit=xray_recorder.max_trace_back)
75-
segment.add_exception(exc, stack)
76-
six.raise_from(exc, exc)
73+
segment.add_exception(err, stack)
74+
raise
7775
finally:
7876
if response is not None:
7977
segment.put_http_meta(http.STATUS, response.status)

aws_xray_sdk/ext/sqlalchemy_core/patch.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import logging
22
import sys
3-
import wrapt
4-
import six
53

64
if sys.version_info >= (3, 0, 0):
75
from urllib.parse import urlparse, uses_netloc
86
else:
97
from urlparse import urlparse, uses_netloc
108

9+
import wrapt
1110

1211
from aws_xray_sdk.core import xray_recorder
1312
from aws_xray_sdk.core.patcher import _PATCHED_MODULES
@@ -73,12 +72,12 @@ def _process_request(wrapped, engine_instance, args, kwargs):
7372
subsegment = None
7473
try:
7574
res = wrapped(*args, **kwargs)
76-
except Exception as exc:
75+
except Exception:
7776
if subsegment is not None:
7877
exception = sys.exc_info()[1]
7978
stack = stacktrace.get_stacktrace(limit=xray_recorder._max_trace_back)
8079
subsegment.add_exception(exception, stack)
81-
six.raise_from(exc, exc)
80+
raise
8281
finally:
8382
if subsegment is not None:
8483
subsegment.set_sql(sql)

0 commit comments

Comments
 (0)