]> granicus.if.org Git - python/commitdiff
expose PYTHON_API_VERSION macro as sys.api_version. Closes patch # 601456.
authorSkip Montanaro <skip@pobox.com>
Tue, 3 Sep 2002 13:25:17 +0000 (13:25 +0000)
committerSkip Montanaro <skip@pobox.com>
Tue, 3 Sep 2002 13:25:17 +0000 (13:25 +0000)
Doc/lib/libsys.tex
Misc/NEWS
Python/sysmodule.c

index 4aa2d4a14ec81a0935d2d96ac290e0b2c5e4a4fd..eec02e0636aabbe315d0e1ed533e85a0be547fcf 100644 (file)
@@ -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
index ad8776225ae9e5d41689e45f5753c2bc3d18938b..37ed63aa9a4f528841d25f080b3e909930811b1d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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
index 4a0bf37622bb842e1f88d44f3ea4b29ec6cc2b0f..cdacce36887260a82321357b8452f7c5e102ebf6 100644 (file)
@@ -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);