Skip to content
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

Handle recursive re-raising of exceptions #317

Merged
merged 2 commits into from
Oct 21, 2019
Merged

Handle recursive re-raising of exceptions #317

merged 2 commits into from
Oct 21, 2019

Conversation

tomage
Copy link
Contributor

@tomage tomage commented Aug 30, 2019

Fixes: #318

I implemented what I thought seemed like a fairly sensible way of breaking out of any potential circular path, and also pretty much copied & pasted a unit-test and modified slightly to fit.

I tested this myself on Python 2.7.16 and Python 3.6.6 (I also tested with raise cause from cause on Python 3).

Interestingly, Django has a similar problem, when DEBUG = True. And I just noticed that recently they patched it (see https://code.djangoproject.com/ticket/29393 and https://github.com/django/django/blob/400ec5125ec32e3b18d267bbb4f3aab09d741ce4/django/views/debug.py#L401).

@tomage
Copy link
Contributor Author

tomage commented Aug 30, 2019

Hm.. Now that I look more closely at the Django code, I should probably copy their approach to the test, and use threads to ensure this won't stall tests in case the infinite-loop mechanism breaks (see https://github.com/django/django/pull/10730/files#diff-7ac36566c31afe0c5ce04aaecc0dd1dbR425).
I'll amend tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

100% CPU and RAM when handling exception raised from itself
2 participants