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-128421: make exception group methods thread safe #129298

Merged
merged 3 commits into from
Jan 25, 2025

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Jan 25, 2025

return eg;
PyObject *stack[] = {self->msg, excs};
size_t nargsf = 2 | PY_VECTORCALL_ARGUMENTS_OFFSET;
return PyObject_Vectorcall(PyExc_BaseExceptionGroup, stack, nargsf, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

This makes it thread safe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it was an unrelated optimization merged accidently into this, removed now.

Copy link
Member

Choose a reason for hiding this comment

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

What here makes it thread safe then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What here makes it thread safe then?

Adding @critical_section using argument clinic makes it use critical section around function call which makes it thread safe.

Objects/exceptions.c Outdated Show resolved Hide resolved
@kumaraditya303 kumaraditya303 merged commit 3f2cfd0 into python:main Jan 25, 2025
44 checks passed
@kumaraditya303 kumaraditya303 deleted the exceptions branch January 26, 2025 06:55
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.

2 participants