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

Skip to content

Commit c362cbd

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.
2 parents 3d7c878 + 2522771 commit c362cbd

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
@@ -1156,8 +1156,13 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
11561156
else {
11571157
self->itself = XML_ParserCreate(encoding);
11581158
}
1159+
#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT)
1160+
/* This feature was added upstream in libexpat 2.1.0. Our expat copy
1161+
* has a backport of this feature where we also define XML_HAS_SET_HASH_SALT
1162+
* to indicate that we can still use it. */
11591163
XML_SetHashSalt(self->itself,
11601164
(unsigned long)_Py_HashSecret.prefix);
1165+
#endif
11611166
self->intern = intern;
11621167
Py_XINCREF(self->intern);
11631168
PyObject_GC_Track(self);

0 commit comments

Comments
 (0)