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

GH-91079: Implement C stack limits using addresses, not counters. #130007

Open
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Feb 11, 2025

@@ -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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is UB?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined behavior

Comment on lines +635 to +645
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)}")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")

Copy link
Member

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.

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

Successfully merging this pull request may close these issues.

Stack overflow collecting PGO data on Windows
3 participants