-
-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
GH-91079: Implement C stack limits using addresses, not counters. #130007
base: main
Are you sure you want to change the base?
Conversation
…m independent constants
@@ -112,7 +112,10 @@ struct _ts { | |||
int py_recursion_remaining; | |||
int py_recursion_limit; | |||
|
|||
int c_recursion_remaining; | |||
// These are addresses, but we need to convert to ints to avoid UB. |
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.
what is UB?
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.
undefined behavior
def raises_syntax_or_memory_error(txt): | ||
try: | ||
eval(txt) | ||
self.fail("No exception raised") | ||
except SyntaxError: | ||
pass | ||
except MemoryError: | ||
pass | ||
except Exception as ex: | ||
self.fail(f"Should raise SyntaxError or MemoryError, not {type(ex)}") | ||
|
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.
def raises_syntax_or_memory_error(txt): | |
try: | |
eval(txt) | |
self.fail("No exception raised") | |
except SyntaxError: | |
pass | |
except MemoryError: | |
pass | |
except Exception as ex: | |
self.fail(f"Should raise SyntaxError or MemoryError, not {type(ex)}") | |
def raises_syntax_or_memory_error(txt): | |
try: | |
eval(txt) | |
except (SyntaxError, MemoryError): | |
pass | |
except Exception as ex: | |
self.fail(f"Should raise SyntaxError or MemoryError, not {type(ex)}") | |
else: | |
self.fail("No exception raised") |
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.
Otherwise the exception raised from self.fail
is handled in the except Exception
.
Hopefully, this will also fix #113655.