New submission from Eric Snow:
Py_GetVersion() (in Python/getversion.c) builds the version string returned by
sys.version:
PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s",
PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler());
In turn, Py_GetBuildInfo() (in Modules/getbuildinfo.c) returns the "build"
portion of Python's version string. When available, the tag returned by "hg id
-t" constitutes part of that build string.
The problem is that when using mqueue the result of "hg id -t" can be pretty
long. For example:
issue21226-fix-PyImport_ExecCodeModuleObject.diff qbase qtip tip
That's 74 characters for just part of a build string that may be well over 100
characters. However, Py_GetVersion() truncates it to 80 characters.
The consequence is that this value of sys.version causes
platform._sys_version() to fail since the version string does not match the
expected pattern.
So either Py_GetVersion() should relax (-1) or Py_GetBuildInfo() should
restrict the length of the resulting build string (+1). Would it work to
truncate just the hgid part so that the whole string returned by
Py_GetBuildInfo() is no more than length 80? E.g.
- PyOS_snprintf(buildinfo, sizeof(buildinfo),
- "%s%s%s, %.20s, %.9s", hgid, sep, revision, DATE, TIME);
+ PyOS_snprintf(buildinfo, 80,
+ "%.43s%.1s%.13s, %.20s, %.9s", hgid, sep, revision, DATE,
TIME);
----------
components: Interpreter Core
messages: 216883
nosy: eric.snow
priority: normal
severity: normal
stage: patch review
status: open
title: Py_GetVersion() is broken when using mqueue and a long patch name
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue21313>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com