Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e3e1c6

Browse files
committed
merge 3.2 (#12221)
2 parents 87cdb81 + 0aa71f7 commit 9e3e1c6

2 files changed

Lines changed: 7 additions & 21 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,8 @@ Tools/Demos
780780
Extension Modules
781781
-----------------
782782

783+
- Issue #12221: Replace pyexpat.__version__ with the Python version.
784+
783785
- Issue #12051: Fix segfault in json.dumps() while encoding highly-nested
784786
objects using the C accelerations.
785787

Modules/pyexpat.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,26 +1622,6 @@ static struct PyMethodDef pyexpat_methods[] = {
16221622
PyDoc_STRVAR(pyexpat_module_documentation,
16231623
"Python wrapper for Expat parser.");
16241624

1625-
/* Return a Python string that represents the version number without the
1626-
* extra cruft added by revision control, even if the right options were
1627-
* given to the "cvs export" command to make it not include the extra
1628-
* cruft.
1629-
*/
1630-
static PyObject *
1631-
get_version_string(void)
1632-
{
1633-
static char *rcsid = "$Revision$";
1634-
char *rev = rcsid;
1635-
int i = 0;
1636-
1637-
while (!isdigit(Py_CHARMASK(*rev)))
1638-
++rev;
1639-
while (rev[i] != ' ' && rev[i] != '\0')
1640-
++i;
1641-
1642-
return PyUnicode_FromStringAndSize(rev, i);
1643-
}
1644-
16451625
/* Initialization function for the module */
16461626

16471627
#ifndef MODULE_NAME
@@ -1682,6 +1662,7 @@ MODULE_INITFUNC(void)
16821662
PyObject *errors_module;
16831663
PyObject *modelmod_name;
16841664
PyObject *model_module;
1665+
PyObject *version;
16851666
PyObject *sys_modules;
16861667
PyObject *tmpnum, *tmpstr;
16871668
PyObject *codes_dict;
@@ -1718,7 +1699,10 @@ MODULE_INITFUNC(void)
17181699
Py_INCREF(&Xmlparsetype);
17191700
PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype);
17201701

1721-
PyModule_AddObject(m, "__version__", get_version_string());
1702+
version = PyUnicode_FromString(PY_VERSION);
1703+
if (!version)
1704+
return;
1705+
PyModule_AddObject(m, "__version__", version);
17221706
PyModule_AddStringConstant(m, "EXPAT_VERSION",
17231707
(char *) XML_ExpatVersion());
17241708
{

0 commit comments

Comments
 (0)