X Tutup
The Wayback Machine - https://web.archive.org/web/20221223104416/https://github.com/python/cpython/pull/99503
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 Nov 15, 2022
@ronaldoussoren
Copy link
Contributor Author

ronaldoussoren commented Nov 15, 2022

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.

Copy link
Member

@corona10 corona10 left a comment

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

ronaldoussoren commented Nov 21, 2022

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.
@ronaldoussoren ronaldoussoren merged commit 959ba45 into python:main Nov 22, 2022
15 checks passed
@miss-islington
Copy link
Contributor

miss-islington commented Nov 22, 2022

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

@miss-islington
Copy link
Contributor

miss-islington commented Nov 22, 2022

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

bedevere-bot commented Nov 22, 2022

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

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

bedevere-bot commented Nov 22, 2022

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

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.

None yet

4 participants
X Tutup