Skip to content

bpo-40826: Fix segfaults issue when close file descriptor 0 on REPL #20549

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

Closed
wants to merge 2 commits into from

Conversation

corona10
Copy link
Member

@corona10 corona10 commented May 31, 2020

@JelleZijlstra
Copy link
Member

Thanks for the fix! I'm wondering whether this same segfault could appear in other places. Do you understand why tstate becomes NULL in this case? (I don't.)

@corona10 corona10 requested review from vstinner and pablogsal May 31, 2020 05:17
@corona10
Copy link
Member Author

corona10 commented May 31, 2020

@JelleZijlstra
I am not the expert of this area, but AFAIK if the GIL is released, _PyThreadState_GET can return NULL.
I 've checked some codebase of CPython.
And I 've noticed that PyGILState_GetThisThreadState is used for fallback logic.
PyGILState_GetThisThreadState returns the tstate even if the GIL is released.
But unfortunately PyGILState_GetThisThreadState does not support subinterpreters yet.

@vstinner
PyGILState_GetThisThreadState will support the subinterpereter when every subinterpreters have their own GIL? (I mean near future)

@corona10 corona10 added the type-bug An unexpected behavior, bug, or error label May 31, 2020
@corona10
Copy link
Member Author

corona10 commented Jun 1, 2020

@vstinner will submit the better solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting core review needs backport to 3.9 only security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants