Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0d7dae

Browse files
committed
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?)
1 parent 6e0a349 commit e0d7dae

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

Python/sysmodule.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@ _PySys_Init()
396396
Py_XDECREF(syserr);
397397
PyDict_SetItemString(sysdict, "version",
398398
v = PyString_FromString(Py_GetVersion()));
399+
PyDict_SetItemString(sysdict, "hexversion",
400+
v = PyInt_FromLong(PY_VERSION_HEX));
399401
Py_XDECREF(v);
400402
PyDict_SetItemString(sysdict, "copyright",
401403
v = PyString_FromString(Py_GetCopyright()));

0 commit comments

Comments
 (0)