mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Add sys.hexversion, which is an integer encoding the version in hexadecimal.
In other words, hex(sys.hexversion) == 0x010502b2 for Python 1.5.2b2. This is derived from the new variable PY_VERSION_HEX defined in patchlevel.h. (Cute, eh?)
This commit is contained in:
parent
6e0a3499ab
commit
e0d7dae3b8
1 changed files with 2 additions and 0 deletions
|
@ -396,6 +396,8 @@ _PySys_Init()
|
|||
Py_XDECREF(syserr);
|
||||
PyDict_SetItemString(sysdict, "version",
|
||||
v = PyString_FromString(Py_GetVersion()));
|
||||
PyDict_SetItemString(sysdict, "hexversion",
|
||||
v = PyInt_FromLong(PY_VERSION_HEX));
|
||||
Py_XDECREF(v);
|
||||
PyDict_SetItemString(sysdict, "copyright",
|
||||
v = PyString_FromString(Py_GetCopyright()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue