summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-06-01 00:06:17 (GMT)
committerBenjamin Peterson <benjamin@python.org>2011-06-01 00:06:17 (GMT)
commit0aa71f79821e22c987f86808b0333d57c663728c (patch)
tree75c1e3ebcbaed80d6b5ac9af498676ff7b9af108
parent87b9bc3893bac402bd773a83ee6734507f978607 (diff)
parenta22c98de8507b18ed0c0933f81e6b0ab63467d11 (diff)
downloadcpython-0aa71f79821e22c987f86808b0333d57c663728c.zip
cpython-0aa71f79821e22c987f86808b0333d57c663728c.tar.gz
cpython-0aa71f79821e22c987f86808b0333d57c663728c.tar.bz2
merge 3.1 (#12221)
-rw-r--r--Misc/NEWS5
-rw-r--r--Modules/pyexpat.c26
2 files changed, 10 insertions, 21 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index 3703ac5..baf235c 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -52,6 +52,11 @@ Library
- Issue #12065: connect_ex() on an SSL socket now returns the original errno
when the socket's timeout expires (it used to return None).
+Extension Modules
+-----------------
+
+- Issue #12221: Replace pyexpat.__version__ with the Python version.
+
Build
-----
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index 40d9324..d295a0f 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1621,26 +1621,6 @@ static struct PyMethodDef pyexpat_methods[] = {
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
@@ -1681,6 +1661,7 @@ MODULE_INITFUNC(void)
PyObject *errors_module;
PyObject *modelmod_name;
PyObject *model_module;
+ PyObject *version;
PyObject *sys_modules;
PyObject *tmpnum, *tmpstr;
PyObject *codes_dict;
@@ -1717,7 +1698,10 @@ MODULE_INITFUNC(void)
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());
{