From: Guido van Rossum Date: Sun, 3 Jan 1999 12:55:39 +0000 (+0000) Subject: Add sys.hexversion, which is an integer encoding the version in hexadecimal. X-Git-Tag: v1.5.2b2~482 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e0d7dae3b8008b5037df6cb212ca6efacf7a012d;p=thirdparty%2FPython%2Fcpython.git 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?) --- diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 6c834d0808c2..e078d7b54464 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -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()));