GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-108223: Add [NOGIL] marker to sys.version by vstinner · Pull Request #108239 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Aug 21, 2023 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

If Python is configured with --disable-gil, add " [NOGIL]" suffix to sys.version. It should help users to check if they are running a regular Python build with a GIL, or a custom Python build with the new experimental no GIL.

sys.version is commonly requested in bug reports: knowing if Python was configured with --disable-gil should ease debug.

Example on Linux with --disable-gil:

$ ./python -VV
Python 3.13.0a0 (heads/main-dirty:d63972e289, Aug 21 2023,
21:43:45) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] [NOGIL]
  • Issue: Add --disable-gil option to configure #108223

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-108223: Add [NOGIL] marker to sys.version
b1aa038
If Python is configured with --disable-gil, add " [NOGIL]" suffix to
sys.version. It should help users to check if they are running a
regular Python build with a GIL, or a custom Python build with the
new experimental no GIL.

sys.version is commonly requested in bug reports: knowing if Python
was configured with --disable-gil should ease debug.

Example on Linux with --disable-gil:

    $ ./python -VV
    Python 3.13.0a0 (heads/main-dirty:d63972e289, Aug 21 2023,
    21:43:45) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] [NOGIL]
@bedevere-bot bedevere-bot mentioned this pull request Aug 21, 2023
Add --disable-gil option to configure #108223
Closed
@bedevere-bot bedevere-bot added the awaiting core review label Aug 21, 2023
@vstinner

vstinner commented Aug 21, 2023

Copy link
Copy Markdown
Member Author

The problem of this change is that some scripts rely on the exact sys.version format and parse it with a regular expression or something else.

My previous attempt to add "build information" to sys.version was rejected: #100086 Instead, I modified libregrtest to log "build information": see #108238.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner added the skip news label Aug 21, 2023
@erlend-aasland

erlend-aasland commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

Can't you use sysconfig.get_config_vars for this?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

I think changing the format of sys.version warrants a NEWS entry ;)

AlexWaygood reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Aug 22, 2023

Copy link
Copy Markdown
Member Author

Can't you use sysconfig.get_config_vars for this?

You mean to leave sys.version unchanged and ask users to dig into sysconfig to check if they are using a NOGIL build or not?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

Can't you use sysconfig.get_config_vars for this?

You mean to leave sys.version unchanged and ask users to dig into sysconfig to check if they are using a NOGIL build or not?

Yes.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Aug 22, 2023

Copy link
Copy Markdown
Member Author

Sure, sysconfig.get_config_var('Py_NOGIL') can be checked.

I'm worried that if tomorrow NOGIL becomes more popular, users may start reporting bugs without even knowing that they use an experimental NOGIL build. Adding a marker to sys.version should help bug triage, but it's an open question. Sure, sys.version can be left unchanged for now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland

erlend-aasland commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

I don't think changing the semantics of sys.version is the right solution to that problem though. If we encourage sys.version to be part of a bug report, perhaps a better thing to do would be to add an API for buildinfo (sys.buildinfo?) and encourage users to include also that in their bug reports. For all I know, there may already be such an API :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Aug 22, 2023

Copy link
Copy Markdown
Member Author

a better thing to do would be to add an API for buildinfo (sys.buildinfo?)

I wrote get_build_info() in test.support.libregrtest.utils for that.

It's hard to decide which build options are relevant to a bug report or not, so I wrote test.pythoninfo which is a giant key-value dump with "everything" :-)

Should we include info which can change how C extensions are loaded? Compiler options? Python ABI? If you get a crash in a third party extension, is it useful to know how it was built? (well, sometimes it is: see this fastmath issue :-)).

I also added sys.thread_info to skip some tests depending on the lock implementation :-)

I don't think changing the semantics of sys.version is the right solution to that problem though

I'm not sure neither, so I close my issue. We can revisit this idea later ;-)

erlend-aasland reacted with heart emoji
All reactions
  • ❤️ 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner closed this Aug 22, 2023
@vstinner
vstinner deleted the sys_version_nogil branch August 22, 2023 12:45
@erlend-aasland

erlend-aasland commented Aug 22, 2023

Copy link
Copy Markdown
Contributor

It's hard to decide which build options are relevant to a bug report or not, so I wrote test.pythoninfo which is a giant key-value dump with "everything" :-)

Exactly; right now, nogil makes sense. In two years time, who knows what makes sense to include :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request May 18, 2024
gh-119132: Update sys.version to identify free-threaded or not. #119134
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting core review skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @erlend-aasland @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.