[Python-checkins] cpython (3.1): simply use the Python version for pyexpat.__version__ #12221

benjamin.peterson python-checkins at python.org
Wed Jun 1 02:08:29 CEST 2011


http://hg.python.org/cpython/rev/9c23efa3f5c7
changeset:   70562:9c23efa3f5c7
branch:      3.1
parent:      70505:35419f276c60
user:        Benjamin Peterson <benjamin at python.org>
date:        Tue May 31 18:59:49 2011 -0500
summary:
  simply use the Python version for pyexpat.__version__ #12221

files:
  Misc/NEWS         |  10 ++++++++++
  Modules/pyexpat.c |  26 +++++---------------------
  2 files changed, 15 insertions(+), 21 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2,6 +2,16 @@
 Python News
 +++++++++++
 
+What's New in Python 3.1.4?
+===========================
+
+*Release date: 2011-05-XX*
+
+Extension Modules
+-----------------
+
+- Issue #12221: Replace pyexpat.__version__ with the Python version.
+
 What's New in Python 3.1.4 release candidate 1?
 ===============================================
 
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1730,26 +1730,6 @@
 PyDoc_STRVAR(pyexpat_module_documentation,
 "Python wrapper for Expat parser.");
 
-/* Return a Python string that represents the version number without the
- * extra cruft added by revision control, even if the right options were
- * given to the "cvs export" command to make it not include the extra
- * cruft.
- */
-static PyObject *
-get_version_string(void)
-{
-    static char *rcsid = "$Revision$";
-    char *rev = rcsid;
-    int i = 0;
-
-    while (!isdigit(Py_CHARMASK(*rev)))
-        ++rev;
-    while (rev[i] != ' ' && rev[i] != '\0')
-        ++i;
-
-    return PyUnicode_FromStringAndSize(rev, i);
-}
-
 /* Initialization function for the module */
 
 #ifndef MODULE_NAME
@@ -1790,6 +1770,7 @@
     PyObject *errors_module;
     PyObject *modelmod_name;
     PyObject *model_module;
+    PyObject *version;
     PyObject *sys_modules;
     static struct PyExpat_CAPI capi;
     PyObject* capi_object;
@@ -1822,7 +1803,10 @@
     Py_INCREF(&Xmlparsetype);
     PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype);
 
-    PyModule_AddObject(m, "__version__", get_version_string());
+    version = PyUnicode_FromString(PY_VERSION);
+    if (!version)
+        return;
+    PyModule_AddObject(m, "__version__", version);
     PyModule_AddStringConstant(m, "EXPAT_VERSION",
                                (char *) XML_ExpatVersion());
     {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list