Simplify creation of the version_info value for clarity, per

suggestion from Greg Stein.
This commit is contained in:
Fred Drake 2000-04-13 20:03:20 +00:00
parent 9cf7587fdc
commit 6d27c1eb32

View file

@ -383,6 +383,7 @@ _PySys_Init()
extern int fclose Py_PROTO((FILE *)); extern int fclose Py_PROTO((FILE *));
PyObject *m, *v, *sysdict; PyObject *m, *v, *sysdict;
PyObject *sysin, *sysout, *syserr; PyObject *sysin, *sysout, *syserr;
char *s;
m = Py_InitModule3("sys", sys_methods, sys_doc); m = Py_InitModule3("sys", sys_methods, sys_doc);
sysdict = PyModule_GetDict(m); sysdict = PyModule_GetDict(m);
@ -413,21 +414,21 @@ _PySys_Init()
* the field, so don't get too fancy with the pre-processor! * the field, so don't get too fancy with the pre-processor!
*/ */
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA #if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA
v = PyString_FromString("alpha"); s = "alpha";
#endif #endif
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA #if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA
v = PyString_FromString("beta"); s = "beta";
#endif #endif
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA #if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA
v = PyString_FromString("candidate"); s = "candidate";
#endif #endif
#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL #if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL
v = PyString_FromString("final"); s = "final";
#endif #endif
PyDict_SetItemString(sysdict, "version_info", PyDict_SetItemString(sysdict, "version_info",
v = Py_BuildValue("iiiNi", PY_MAJOR_VERSION, v = Py_BuildValue("iiisi", PY_MAJOR_VERSION,
PY_MINOR_VERSION, PY_MINOR_VERSION,
PY_MICRO_VERSION, v, PY_MICRO_VERSION, s,
PY_RELEASE_SERIAL)); PY_RELEASE_SERIAL));
Py_XDECREF(v); Py_XDECREF(v);
PyDict_SetItemString(sysdict, "copyright", PyDict_SetItemString(sysdict, "copyright",