diff options
author | Benjamin Peterson <benjamin@python.org> | 2011-05-31 23:59:49 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2011-05-31 23:59:49 (GMT) |
commit | a22c98de8507b18ed0c0933f81e6b0ab63467d11 (patch) | |
tree | 1ee6a7c41d1b0dfe928018fe381773148ddd5c34 /Modules | |
parent | bb11bb0dbb9fc05072317d2bd59d8d4fa470d41e (diff) | |
download | cpython-a22c98de8507b18ed0c0933f81e6b0ab63467d11.zip cpython-a22c98de8507b18ed0c0933f81e6b0ab63467d11.tar.gz cpython-a22c98de8507b18ed0c0933f81e6b0ab63467d11.tar.bz2 |
simply use the Python version for pyexpat.__version__ #12221
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/pyexpat.c | 26 |
1 files changed, 5 insertions, 21 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c index cc62274..7c610a8 100644 --- a/Modules/pyexpat.c +++ b/Modules/pyexpat.c @@ -1730,26 +1730,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 @@ -1790,6 +1770,7 @@ MODULE_INITFUNC(void) 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 @@ 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()); { |