summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-04-13 17:44:51 (GMT)
committerFred Drake <fdrake@acm.org>2000-04-13 17:44:51 (GMT)
commit93a20bf87c22d54353568f3a411ed11b2638134e (patch)
treefd0ee30394f4468874b9c5c32406bcf7be9f7fba /Python/sysmodule.c
parent4d65d73686fa535c2f4ce4047f82bf0d7255d46c (diff)
downloadcpython-93a20bf87c22d54353568f3a411ed11b2638134e.zip
cpython-93a20bf87c22d54353568f3a411ed11b2638134e.tar.gz
cpython-93a20bf87c22d54353568f3a411ed11b2638134e.tar.bz2
Capitulate, changing version_info to a 5-tuple:
major, minor, micro, level, serial Values are now monotonically increasing with each new release.
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index cf9fea5..e7c0d48 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -408,21 +408,27 @@ _PySys_Init()
PyDict_SetItemString(sysdict, "hexversion",
v = PyInt_FromLong(PY_VERSION_HEX));
Py_XDECREF(v);
+ /*
+ * These release level checks are mutually exclusive and cover
+ * the field, so don't get too fancy with the pre-processor!
+ */
+#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA
+ v = PyString_FromString("alpha");
+#endif
+#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA
+ v = PyString_FromString("beta");
+#endif
+#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA
+ v = PyString_FromString("candidate");
+#endif
#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 */
+ v = PyString_FromString("final");
+#endif
PyDict_SetItemString(sysdict, "version_info",
- v = Py_BuildValue("iiiN", PY_MAJOR_VERSION,
+ v = Py_BuildValue("iiiNi", PY_MAJOR_VERSION,
PY_MINOR_VERSION,
- PY_MICRO_VERSION, v));
+ PY_MICRO_VERSION, v,
+ PY_RELEASE_SERIAL));
Py_XDECREF(v);
PyDict_SetItemString(sysdict, "copyright",
v = PyString_FromString(Py_GetCopyright()));