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

Debug context: check that HPy API is accessed only from Python threads #437

Open
steve-s opened this issue Jun 13, 2023 · 0 comments
Open
Labels
good first issue Good for newcomers

Comments

@steve-s
Copy link
Contributor

steve-s commented Jun 13, 2023

Possible implementation: store thread ID in the debug context just before calling extension function, and check it on every API call.

Caveats:

  • is there some portable way to get something like thread ID in C. First implementation could be just for Unix/Linux. We can have some abstraction like we have for stack traces.
  • play nicely with debug context reuse (turn the check off when we run out of contexts?)
  • should have happy and bad case tests that actually spin multiple Python threads (context from one Python thread must not be used in other Python thread too), and a bad case test that spins unrelated C threads and tries to call HPy API in them
@steve-s steve-s added the good first issue Good for newcomers label Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant