classification
Title: Replace 'default' with 'main' as default in sys.version
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: corona10, ezio.melotti, miss-islington, youknowone
Priority: normal Keywords: easy (C), patch

Created on 2021-10-19 23:40 by ezio.melotti, last changed 2021-10-20 17:55 by corona10. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 29100 merged youknowone, 2021-10-20 16:05
PR 29106 merged miss-islington, 2021-10-20 17:09
PR 29107 merged miss-islington, 2021-10-20 17:09
Messages (9)
msg404380 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2021-10-19 23:40
sys.version returns '3.10.0 (default, Oct  5 2021, 23:49:26) [GCC 10.2.1 20210110]'

'default' is supposed to represent the name of the branch, and it's been there since the HG days: https://github.com/python/cpython/blob/fc64c351c7757f0ebdb7da65cb74871e494a2add/Modules/getbuildinfo.c#L44

When the code was updated for Git in #27593, the default remained the same: https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Modules/getbuildinfo.c#L44

The default should be updated to 'main'.

Note that _Py_gitidentifier is supposed to return meaningful values while building from within a git checkout -- when it fails to do so the default value is used.  This can also be tested through sys._git (which returns ('CPython', '', '')), but at the moment I can't build from a git checkout and verify that _Py_gitidentifier returns the correct branch.  If not, a separate issue should be created.
msg404383 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-10-20 01:32
+1
msg404384 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-10-20 02:12
> youknowone

Do you want to take a look?
msg404410 - (view) Author: youknowone (youknowone) * Date: 2021-10-20 09:44
Thanks! I will look in it
msg404412 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-10-20 09:46
> Note that _Py_gitidentifier is supposed to return meaningful values while building from within a git checkout 

'3.11.0a1+ (heads/main:3163e68c34, Oct 20 2021, 18:39:18) [Clang 12.0.0 (clang-1200.0.32.29)]

FYI, it retrieves branch information well
msg404499 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-10-20 17:09
New changeset d2cd5eef0c3fc0431bfe3fc24b4c020ebfcf8aad by Jeong YunWon in branch 'main':
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)
https://github.com/python/cpython/commit/d2cd5eef0c3fc0431bfe3fc24b4c020ebfcf8aad
msg404504 - (view) Author: miss-islington (miss-islington) Date: 2021-10-20 17:41
New changeset 696a89fef81f8229ebff9c32dfd36921c04f0890 by Miss Islington (bot) in branch '3.10':
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)
https://github.com/python/cpython/commit/696a89fef81f8229ebff9c32dfd36921c04f0890
msg404505 - (view) Author: miss-islington (miss-islington) Date: 2021-10-20 17:45
New changeset 1249ce7c6c0ac7a99a72e6e7b8b10dd64158c386 by Miss Islington (bot) in branch '3.9':
bpo-45532: Replace 'default' with 'main' as default in sys.version (GH-29100)
https://github.com/python/cpython/commit/1249ce7c6c0ac7a99a72e6e7b8b10dd64158c386
msg404506 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-10-20 17:55
Thank you Ezio and youknowone :)
History
Date User Action Args
2021-10-20 17:55:32corona10setstatus: open -> closed

messages: + msg404506
stage: patch review -> resolved
2021-10-20 17:45:13miss-islingtonsetmessages: + msg404505
2021-10-20 17:41:49miss-islingtonsetmessages: + msg404504
2021-10-20 17:09:18miss-islingtonsetpull_requests: + pull_request27375
2021-10-20 17:09:13miss-islingtonsetnosy: + miss-islington
pull_requests: + pull_request27374
2021-10-20 17:09:12corona10setmessages: + msg404499
2021-10-20 16:05:03youknowonesetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request27370
2021-10-20 09:46:37corona10setmessages: + msg404412
2021-10-20 09:44:59youknowonesetmessages: + msg404410
2021-10-20 02:12:43corona10setnosy: + youknowone
messages: + msg404384
2021-10-20 01:39:43corona10setkeywords: + easy (C)
2021-10-20 01:32:59corona10setmessages: + msg404383
2021-10-20 01:32:51corona10setnosy: + corona10
2021-10-19 23:40:13ezio.melotticreate