]> granicus.if.org Git - python/commitdiff
Fixes Issue 14234: fix for the previous commit, keep compilation when
authorGregory P. Smith <greg@krypto.org>
Thu, 15 Mar 2012 01:10:37 +0000 (18:10 -0700)
committerGregory P. Smith <greg@krypto.org>
Thu, 15 Mar 2012 01:10:37 +0000 (18:10 -0700)
using --with-system-expat working when the system expat does not have
salted hash support.

Modules/expat/expat.h
Modules/pyexpat.c

index cffdb8f6299691a8c5bdf58c857bc959393aa30c..89646d2bcee1d57940fb8ddd01b846ec50797959 100644 (file)
@@ -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.
 */
index c1142de54dc106d89b8f11121c71fb4e2129a040..bf81e2af01a335e114536f27092c2e48f3dc2192 100644 (file)
@@ -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);