diff options
-rw-r--r-- | Doc/lib/libsys.tex | 6 | ||||
-rw-r--r-- | Misc/NEWS | 4 | ||||
-rw-r--r-- | Python/sysmodule.c | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/Doc/lib/libsys.tex b/Doc/lib/libsys.tex index 4aa2d4a..eec02e0 100644 --- a/Doc/lib/libsys.tex +++ b/Doc/lib/libsys.tex @@ -459,6 +459,12 @@ else: \end{verbatim} \end{datadesc} +\begin{datadesc}{api_version} + The C API version for this interpreter. Programmers may find this useful + when debugging version conflicts between Python and extension + modules. \versionadded{2.3} +\end{datadesc} + \begin{datadesc}{version_info} A tuple containing the five components of the version number: \var{major}, \var{minor}, \var{micro}, \var{releaselevel}, and @@ -303,6 +303,10 @@ Extension modules - signal.sigpending, signal.sigprocmask and signal.sigsuspend have been added where available. +- The sys module acquired a new attribute, api_version, which evaluates + to the value of the PYTHON_API_VERSION macro with which the + interpreter was compiled. + Library - New module: sets, defines the class Set that implements a mutable diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 4a0bf37..cdacce3 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -793,6 +793,9 @@ _PySys_Init(void) PY_MICRO_VERSION, s, PY_RELEASE_SERIAL)); Py_XDECREF(v); + PyDict_SetItemString(sysdict, "api_version", + v = PyInt_FromLong(PYTHON_API_VERSION)); + Py_XDECREF(v); PyDict_SetItemString(sysdict, "copyright", v = PyString_FromString(Py_GetCopyright())); Py_XDECREF(v); |