-
Notifications
You must be signed in to change notification settings - Fork 905
add Python::try_attach
#5342
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
add Python::try_attach
#5342
Conversation
0dd8498 to
185a069
Compare
185a069 to
cf5720d
Compare
Icxolu
left a comment
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.
I wonder whether try_acquire should maybe return a Result instead, such that it is possible to check the failure cause. This would allow us to reuse try_acquire in normal attach (lifting the auto-initialize into attach) and keep individual panic messages.
While we're here, we should add the GC traversal panic to the attach documentation.
|
Good idea, I pushed a commit to make that adjustment and do a bit of general tidying up at the same time. |
Icxolu
left a comment
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.
Great, looks good!
Just noticed that we should do a follow up to rename Python::assume_gil_acquired() into Python::assume_attached
|
Ah yes and we should include that in 0.26 too. 👍 |
Followup to #5317
This adds
Python::try_attach, an alternative toPython::attachwhich avoids attempting to attach to the interpreter when the interpreter is not in a suitable state for doing so.Only last commit is new, will leave in draft until suitable for review.