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

Skip to content

Commit 2522771

Browse files
committed
Fixes Issue 14234: fix for the previous commit, keep compilation when
using --with-system-expat working when the system expat does not have salted hash support.
1 parent 4552b2e commit 2522771

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

Modules/expat/expat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,8 @@ XMLPARSEAPI(int)
892892
XML_SetHashSalt(XML_Parser parser,
893893
unsigned long hash_salt);
894894

895+
#define XML_HAS_SET_HASH_SALT /* Python Only: Defined for pyexpat.c. */
896+
895897
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
896898
XML_GetErrorCode returns information about the error.
897899
*/

Modules/pyexpat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1150,8 +1150,13 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
11501150
else {
11511151
self->itself = XML_ParserCreate(encoding);
11521152
}
1153+
#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT)
1154+
/* This feature was added upstream in libexpat 2.1.0. Our expat copy
1155+
* has a backport of this feature where we also define XML_HAS_SET_HASH_SALT
1156+
* to indicate that we can still use it. */
11531157
XML_SetHashSalt(self->itself,
11541158
(unsigned long)_Py_HashSecret.prefix);
1159+
#endif
11551160
self->intern = intern;
11561161
Py_XINCREF(self->intern);
11571162
PyObject_GC_Track(self);

0 commit comments

Comments
 (0)