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-97001: Release GIL in termios extension #99503

Merged
merged 4 commits into from
Nov 22, 2022

Conversation

ronaldoussoren
Copy link
Contributor

@ronaldoussoren ronaldoussoren commented Nov 15, 2022

Calls to termios APIs might block, therefore give up the GIL while performing these calls.

@ronaldoussoren ronaldoussoren requested a review from a team November 15, 2022 11:36
@ronaldoussoren
Copy link
Contributor Author

IMHO this is a bug fix because you can currently block all Python threads using termios, hence it should be back ported to 3.10 and 3.11.

@ronaldoussoren ronaldoussoren added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Nov 15, 2022
Copy link
Member

@corona10 corona10 left a comment

Choose a reason for hiding this comment

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

Overall lgtm,

Super nit: Please unindent between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS when considering the style of other code bases.

Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
Modules/termios.c Outdated Show resolved Hide resolved
@ronaldoussoren
Copy link
Contributor Author

Overall lgtm,

Super nit: Please unindent between Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS when considering the style of other code bases.

I'll change that before merging.

I indent the code between these markers in my own code (including teaching clang-format about this) because this makes it clearer that there's a block of code with slightly different semantics. I prefer my own code style here, but consistency wins.

This matches the rest of the code base.
@miss-islington
Copy link
Contributor

Thanks @ronaldoussoren for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry, @ronaldoussoren, I could not cleanly backport this to 3.10 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 959ba45d75953caa911e16b4c2a277978fc4b9b0 3.10

@bedevere-bot
Copy link

GH-99679 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Nov 22, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 22, 2022
Without releasing the GIL calls to termios APIs might block the entire interpreter.
(cherry picked from commit 959ba45)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
@bedevere-bot
Copy link

GH-99680 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Nov 22, 2022
miss-islington added a commit that referenced this pull request Nov 22, 2022
Without releasing the GIL calls to termios APIs might block the entire interpreter.
(cherry picked from commit 959ba45)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
ronaldoussoren added a commit that referenced this pull request Nov 22, 2022
Without releasing the GIL calls to termios APIs might block the entire interpreter..
(cherry picked from commit 959ba45)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants