-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement PEP3134 to discover underlying problems with python3 #355
Conversation
|
||
if sys.version_info >= (3, 0, 0): | ||
from urllib.parse import urlparse, uses_netloc | ||
else: | ||
from urlparse import urlparse, uses_netloc | ||
|
||
import wrapt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just moved upwards to remove pylint:C0413
This ticket is tied to the following troubleshooting and discovering this issue: Pynamodb 1073 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
I've never seen Python 3.11.0 (main, Nov 12 2022, 07:10:51) [GCC 11.2.1 20220219]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.6.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: try:
...: raise ValueError("foo")
...: except ValueError as exc:
...: print("bar")
...: raise exc from exc
...:
bar
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In [1], line 5
4 print("bar")
----> 5 raise exc from exc
Cell In [1], line 2
1 try:
----> 2 raise ValueError("foo")
3 except ValueError as exc:
ValueError: foo
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
[... skipping hidden 1 frame]
Cell In [1], line 5
4 print("bar")
----> 5 raise exc from exc
Cell In [1], line 2
1 try:
----> 2 raise ValueError("foo")
3 except ValueError as exc:
ValueError: foo
The above exception was the direct cause of the following exception:
ValueError Traceback (most recent call last)
Cell In [1], line 5
3 except ValueError as exc:
4 print("bar")
----> 5 raise exc from exc
Cell In [1], line 2
1 try:
----> 2 raise ValueError("foo")
3 except ValueError as exc:
4 print("bar")
ValueError: foo PEP 3134 doesn't mention such a use case either. raiseIn [2]: raise ValueError("foo")
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [2], line 1
----> 1 raise ValueError("foo")
ValueError: foo try-catch-raise without fromIn [3]: try:
...: raise ValueError("foo")
...: except ValueError as exc:
...: print("bar")
...: raise exc
...:
bar
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In [3], line 5
3 except ValueError as exc:
4 print("bar")
----> 5 raise exc
Cell In [3], line 2
1 try:
----> 2 raise ValueError("foo")
3 except ValueError as exc:
4 print("bar")
ValueError: foo |
This PR was made because there was underlying issue hidden by the missing raise from syntax in aws-xray-sdk core. If this would have been implemented previously, the underlying issue would have been seen without disabling xray in the application code. What was seen in logs prior to this PRWhat this PR improves
Essentially it will give that Reference of the underlying issue that was actually the issue: |
I saw both issues and read through them, but that doesn't explain why this is an issue in the first place. A simple re-raise should not omit parts of the stacktrace. In pynamodb/PynamoDB#1073 you said that you “disable[d] AWS X-ray to get the proper root cause to popup.” Did you also try it with this patch and X-Ray enabled? I'm not convinced that this actually solves your problem. Maybe X-Ray accessing the stacktrace has something to do with it? I played around with that, but found no hint that would support this theory. But my toy stacktraces were small. From
getsentry/sentry-python#1626 mentions Python 3.9, therefore the re-raise shouldn't have changed the traceback. |
After reviewing your comments I agree with you that this does not solve the problem.
No, manipulating dependencies would be troublesome with our way of deploying lambda Essentially this would behave as it did (with sentry-sdk[flask]==1.9.8)
|
#355)" (#371) This reverts commit 4660169. Closes #370 Co-authored-by: Carol Abadeer <[email protected]> Co-authored-by: Prashant Srivastava <[email protected]>
Issue #, if available:
#354
Description of changes:
Implement PEP3134 through six.raise_from to support python2 and python3.
Also move one import to top of the module to better comply with pylint (C0413:wrong-import-position)
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.