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

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