summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-04-13 15:29:10 (GMT)
committerFred Drake <fdrake@acm.org>2000-04-13 15:29:10 (GMT)
commit801c08d700c16296dccd8f9fa31979d3ed052751 (patch)
treed38d9c15cf45b530f3c4edca7f61728bdb41f5d0 /Python/sysmodule.c
parent3155db3b793d384054abd586bcd42e8d4f5061da (diff)
downloadcpython-801c08d700c16296dccd8f9fa31979d3ed052751.zip
cpython-801c08d700c16296dccd8f9fa31979d3ed052751.tar.gz
cpython-801c08d700c16296dccd8f9fa31979d3ed052751.tar.bz2
Define version_info to be a tuple (major, minor, micro, level); level
is a string "a2", "b1", "c1", or '' for a final release. Added version_info and hexversion to the module docstring.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index fa235fd..cf9fea5 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -352,7 +352,9 @@ Static objects:\n\
\n\
maxint -- the largest supported integer (the smallest is -maxint-1)\n\
builtin_module_names -- tuple of module names built into this intepreter\n\
-version -- the version of this interpreter\n\
+version -- the version of this interpreter as a string\n\
+version_info -- version information as a tuple\n\
+hexversion -- version information encoded as a single integer\n\
copyright -- copyright notice pertaining to this interpreter\n\
platform -- platform identifier\n\
executable -- pathname of this Python interpreter\n\
@@ -406,6 +408,22 @@ _PySys_Init()
PyDict_SetItemString(sysdict, "hexversion",
v = PyInt_FromLong(PY_VERSION_HEX));
Py_XDECREF(v);
+#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL
+ v = PyString_FromStringAndSize(NULL, 0);
+#else
+ {
+ char buff[3];
+ buff[0] = PY_RELEASE_LEVEL - PY_RELEASE_LEVEL_ALPHA + 'a';
+ buff[1] = PY_RELEASE_SERIAL + '0';
+ buff[2] = '\0';
+ v = PyString_FromString(buff);
+ }
+#endif /* PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL */
+ PyDict_SetItemString(sysdict, "version_info",
+ v = Py_BuildValue("iiiN", PY_MAJOR_VERSION,
+ PY_MINOR_VERSION,
+ PY_MICRO_VERSION, v));
+ Py_XDECREF(v);
PyDict_SetItemString(sysdict, "copyright",
v = PyString_FromString(Py_GetCopyright()));
Py_XDECREF(v);