Blame SOURCES/00310-use-xml-sethashsalt-in-elementtree.patch

cb219e
diff --git a/Include/pyexpat.h b/Include/pyexpat.h
cb219e
index 5340ef5..3fc5fa5 100644
cb219e
--- a/Include/pyexpat.h
cb219e
+++ b/Include/pyexpat.h
cb219e
@@ -3,7 +3,7 @@
cb219e
 
cb219e
 /* note: you must import expat.h before importing this module! */
cb219e
 
cb219e
-#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.0"
cb219e
+#define PyExpat_CAPI_MAGIC  "pyexpat.expat_CAPI 1.1"
cb219e
 #define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI"
cb219e
 
cb219e
 struct PyExpat_CAPI 
cb219e
@@ -43,6 +43,8 @@ struct PyExpat_CAPI
cb219e
         XML_Parser parser, XML_UnknownEncodingHandler handler,
cb219e
         void *encodingHandlerData);
cb219e
     void (*SetUserData)(XML_Parser parser, void *userData);
cb219e
+    /* might be none for expat < 2.1.0 */
cb219e
+    int (*SetHashSalt)(XML_Parser parser, unsigned long hash_salt);
cb219e
     /* always add new stuff to the end! */
cb219e
 };
cb219e
 
cb219e
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
cb219e
index 379aa01..ce62081 100644
cb219e
--- a/Modules/_elementtree.c
cb219e
+++ b/Modules/_elementtree.c
cb219e
@@ -2500,6 +2500,11 @@ xmlparser(PyObject* self_, PyObject* args, PyObject* kw)
cb219e
         PyErr_NoMemory();
cb219e
         return NULL;
cb219e
     }
cb219e
+    /* expat < 2.1.0 has no XML_SetHashSalt() */
cb219e
+    if (EXPAT(SetHashSalt) != NULL) {
cb219e
+        EXPAT(SetHashSalt)(self->parser,
cb219e
+                           (unsigned long)_Py_HashSecret.prefix);
cb219e
+    }
cb219e
 
cb219e
     /* setup target handlers */
cb219e
     if (!target) {
cb219e
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
cb219e
index f269113..147b8a9 100644
cb219e
--- a/Modules/pyexpat.c
cb219e
+++ b/Modules/pyexpat.c
cb219e
@@ -2037,6 +2037,11 @@ MODULE_INITFUNC(void)
cb219e
     capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler;
cb219e
     capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler;
cb219e
     capi.SetUserData = XML_SetUserData;
cb219e
+#if XML_COMBINED_VERSION >= 20100
cb219e
+    capi.SetHashSalt = XML_SetHashSalt;
cb219e
+#else
cb219e
+    capi.SetHashSalt = NULL;
cb219e
+#endif
cb219e
 
cb219e
     /* export using capsule */
cb219e
     capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);