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-108223: Add --disable-gil to configure #108227

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

colesbury
Copy link
Contributor

@colesbury colesbury commented Aug 21, 2023

The --disable-gil flags does not do anything yet other than define the Py_NOGIL macro. This is intended to support setting up additional buildbots by @itamaro.

The `--disable-gil` flags does not do anything yet other than define the
Py_NOGIL macro. This is intended to support setting up additional
buildbots.
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.

LGTM

I both check the following cases, and it works as expected!

  • ./configure --disable-gil
  • ./configure

@corona10
Copy link
Member

@colesbury Are you ready to be merged or need more additional work?

@colesbury
Copy link
Contributor Author

@corona10 thanks! it is ready to merge

@corona10 corona10 enabled auto-merge (squash) August 21, 2023 17:25
@corona10 corona10 merged commit b16ecb8 into python:main Aug 21, 2023
21 checks passed
@vstinner
Copy link
Member

define the Py_NOGIL macro

I dislike double negation, would it be possible to have a companion macro, like Py_HAVE_GIL? For example, Py_HAVE_GIL can be always defined, as 0 or 1. Or Py_HAVE_GIL would not be defined if Py_NOGIL is defined.

In the long term, I would prefer that Python has no GIL by default, but so we would only have special code for the legacy build where Python has a GIL. Well, maybe that's a politic question :-)

@colesbury
Copy link
Contributor Author

@vstinner, I generally agree with you about double negation, but I think in this case it's more convenient to define a Py_NOGIL macro or equivalent.

  • All or nearly all of the special code will be fore running without the GIL. I don't expect any special code for running with the GIL. (Especially because --disable-gil builds still need to support running with the GIL as a fallback.)
  • Previous versions of CPython (and PyPy) wouldn't have the Py_HAVE_GIL macro defined, so C-API extensions can't rely on it always being defined, even if we do so in 3.13.
  • It's a bit more convenient to write #ifdef Py_NOGIL than #if Py_HAVE_GIL == 0
  • The Py_NOGIL macro matches the PEP draft

None of these reasons are tremendously important, but the choice of macro name doesn't seem tremendously important either.

@vstinner
Copy link
Member

It's just a remark, I'm fine with Py_NOGIL.

@colesbury colesbury deleted the pep703-configure branch August 21, 2023 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants