Skip to content

Comments

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

Closed
corona10 wants to merge 2 commits intopython:masterfrom
corona10:bpo-40826
Closed

bpo-40826: Fix segfaults issue when close file descriptor 0 on REPL#20549
corona10 wants to merge 2 commits intopython:masterfrom
corona10:bpo-40826

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 pablogsal and vstinner 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 type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants