diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-05-31 19:07:45 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-05-31 19:07:45 -0500 |
commit | 9e3e1c6e4e98b7568fcb29708aeac88bc677c62c (patch) | |
tree | 6f48941c1d0b4b690b85c4f58eca74d35e7a7537 | |
parent | 87cdb81646f6628922c5781dbc15a4dbffb8e923 (diff) | |
parent | 0aa71f79821e22c987f86808b0333d57c663728c (diff) | |
download | cpython-git-9e3e1c6e4e98b7568fcb29708aeac88bc677c62c.tar.gz |
merge 3.2 (#12221)
-rw-r--r-- | Misc/NEWS | 2 | ||||
-rw-r--r-- | Modules/pyexpat.c | 26 |
2 files changed, 7 insertions, 21 deletions
@@ -780,6 +780,8 @@ Tools/Demos Extension Modules ----------------- +- Issue #12221: Replace pyexpat.__version__ with the Python version. + - Issue #12051: Fix segfault in json.dumps() while encoding highly-nested objects using the C accelerations. diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index 4ef09de1ba..1cf699b9c6 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1622,26 +1622,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 @@ -1682,6 +1662,7 @@ MODULE_INITFUNC(void) PyObject *errors_module; PyObject *modelmod_name; PyObject *model_module; + PyObject *version; PyObject *sys_modules; PyObject *tmpnum, *tmpstr; PyObject *codes_dict; @@ -1718,7 +1699,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()); { |