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

bpo-20891: Py_Initialize() now creates the GIL #4700

Merged
merged 4 commits into from
Jan 29, 2018
Merged

bpo-20891: Py_Initialize() now creates the GIL #4700

merged 4 commits into from
Jan 29, 2018

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Dec 4, 2017

The GIL is not more created "on demand" to fix a race condition when
PyGILState_Ensure() is called in a non-Python thread.

https://bugs.python.org/issue20891

@@ -0,0 +1,2 @@
Py_Initialize() now creates the GIL. The GIL is not more created "on demand" to
Copy link
Member

Choose a reason for hiding this comment

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

s/not more/no more/

Copy link
Member Author

Choose a reason for hiding this comment

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

oops, replaced with "no longer"

@pitrou
Copy link
Member

pitrou commented Dec 4, 2017

Is there any documentation to update?

@vstinner
Copy link
Member Author

vstinner commented Dec 4, 2017

Is there any documentation to update?

Done, see my updated PR.

@@ -818,54 +817,39 @@ code, or when embedding the Python interpreter:

This is a no-op when called for a second time.

.. versionchanged:: 3.7
The :term:`GIL` is now initialized by :c:func:`Py_Initialize()`.
Copy link
Member

Choose a reason for hiding this comment

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

I would phrase it more explicitly:

This function is now called by :c:func:`Py_Initialize()`, so you don't have to call it yourself anymore.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@warsaw
Copy link
Member

warsaw commented Dec 15, 2017

This branch seems to fix the issue for me on macOS 10.12.6

@vstinner
Copy link
Member Author

For benchmark results, see https://bugs.python.org/issue20891#msg308588

The GIL is no longer created "on demand" to fix a race condition when
PyGILState_Ensure() is called in a non-Python thread.
Remove also mention of the "thread support", since thread support
cannot be disabled anymore.
Make the assumption that the GIL is always created (by
Py_Initialize()).
@vstinner vstinner merged commit 2914bb3 into python:master Jan 29, 2018
@bedevere-bot
Copy link

@vstinner: Please replace # with GH- in the commit message next time. Thanks!

@vstinner vstinner deleted the gil_created branch January 29, 2018 10:57
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

5 participants