Skip to content

Commit

Permalink
Fixes Issue 14234: fix for the previous commit, keep compilation when
Browse files Browse the repository at this point in the history
using --with-system-expat working when the system expat does not have
salted hash support.
  • Loading branch information
gpshead committed Mar 15, 2012
1 parent 4552b2e commit 2522771
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Modules/expat/expat.h
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,8 @@ XMLPARSEAPI(int)
XML_SetHashSalt(XML_Parser parser,
unsigned long hash_salt);

#define XML_HAS_SET_HASH_SALT /* Python Only: Defined for pyexpat.c. */

/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
XML_GetErrorCode returns information about the error.
*/
Expand Down
5 changes: 5 additions & 0 deletions Modules/pyexpat.c
Original file line number Diff line number Diff line change
Expand Up @@ -1150,8 +1150,13 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
else {
self->itself = XML_ParserCreate(encoding);
}
#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT)
/* This feature was added upstream in libexpat 2.1.0. Our expat copy
* has a backport of this feature where we also define XML_HAS_SET_HASH_SALT
* to indicate that we can still use it. */
XML_SetHashSalt(self->itself,
(unsigned long)_Py_HashSecret.prefix);
#endif
self->intern = intern;
Py_XINCREF(self->intern);
PyObject_GC_Track(self);
Expand Down

0 comments on commit 2522771

Please sign in to comment.