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-91048: fix thread safety for asyncio stack introspection APIs #129399

Merged
merged 2 commits into from
Feb 6, 2025

Conversation

kumaraditya303
Copy link
Contributor

@kumaraditya303 kumaraditya303 commented Jan 28, 2025

Changes:

  • Add critical sections where required before calling impl function
  • Add critical section assertions
  • Move getters setters to be together with others
  • Elide away unnecessary type checks and align functions to take FutureObj * as all the other ones already do. In most cases, we avoid type checking on task which is guaranteed to be task or its subclass.

@kumaraditya303
Copy link
Contributor Author

Merging this as its been sitting idle for over a week now.

@kumaraditya303 kumaraditya303 merged commit 75c5519 into python:main Feb 6, 2025
41 checks passed
@kumaraditya303 kumaraditya303 deleted the tsafe branch February 6, 2025 16:04
if (TaskOrFuture_Check(state, fut) && TaskOrFuture_Check(state, waiter)) {
int res;
Py_BEGIN_CRITICAL_SECTION(fut);
res = future_awaited_by_add(state, (FutureObj *)fut, waiter);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, this should have been future_awaited_by_discard, fixing #129731.

I'm surprised that no tests failed, seems like test coverage is less for these functions...

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
cmaloney pushed a commit to cmaloney/cpython that referenced this pull request Feb 8, 2025
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.

1 participant