summaryrefslogtreecommitdiff
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-01-03 12:55:39 +0000
committerGuido van Rossum <guido@python.org>1999-01-03 12:55:39 +0000
commitd301c2e6fe02ceae04b97d061a64708bb2829b93 (patch)
tree864e8d75cf0dadcda2893d8832e74f2a7a08769c /Python/sysmodule.c
parentb80a85d2a0998c2854d70bd46bb9812ad6857e0e (diff)
downloadcpython-d301c2e6fe02ceae04b97d061a64708bb2829b93.tar.gz
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?)
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 6c834d0808..e078d7b544 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()));