[issue45532] Replace 'default' with 'main' as default in sys.version

Ezio Melotti report at bugs.python.org
Tue Oct 19 19:40:13 EDT 2021


New submission from Ezio Melotti <ezio.melotti at gmail.com>:

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.

----------
components: Interpreter Core
messages: 404380
nosy: ezio.melotti
priority: normal
severity: normal
stage: test needed
status: open
title: Replace 'default' with 'main' as default in sys.version
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45532>
_______________________________________


More information about the Python-bugs-list mailing list