@@ -352,7 +352,9 @@ Static objects:\n\
352352\n\
353353maxint -- the largest supported integer (the smallest is -maxint-1)\n\
354354builtin_module_names -- tuple of module names built into this intepreter\n\
355- version -- the version of this interpreter\n\
355+ version -- the version of this interpreter as a string\n\
356+ version_info -- version information as a tuple\n\
357+ hexversion -- version information encoded as a single integer\n\
356358copyright -- copyright notice pertaining to this interpreter\n\
357359platform -- platform identifier\n\
358360executable -- pathname of this Python interpreter\n\
@@ -406,6 +408,22 @@ _PySys_Init()
406408 PyDict_SetItemString (sysdict , "hexversion" ,
407409 v = PyInt_FromLong (PY_VERSION_HEX ));
408410 Py_XDECREF (v );
411+ #if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL
412+ v = PyString_FromStringAndSize (NULL , 0 );
413+ #else
414+ {
415+ char buff [3 ];
416+ buff [0 ] = PY_RELEASE_LEVEL - PY_RELEASE_LEVEL_ALPHA + 'a' ;
417+ buff [1 ] = PY_RELEASE_SERIAL + '0' ;
418+ buff [2 ] = '\0' ;
419+ v = PyString_FromString (buff );
420+ }
421+ #endif /* PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL */
422+ PyDict_SetItemString (sysdict , "version_info" ,
423+ v = Py_BuildValue ("iiiN" , PY_MAJOR_VERSION ,
424+ PY_MINOR_VERSION ,
425+ PY_MICRO_VERSION , v ));
426+ Py_XDECREF (v );
409427 PyDict_SetItemString (sysdict , "copyright" ,
410428 v = PyString_FromString (Py_GetCopyright ()));
411429 Py_XDECREF (v );
0 commit comments