summaryrefslogtreecommitdiffstats
path: root/Modules/pyexpat.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2018-09-18 12:38:58 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-18 12:38:58 (GMT)
commitcb5778f00ce48631c7140f33ba242496aaf7102b (patch)
tree9905106a1ee7ce94d9fa93b6ac395634c2f24c2f /Modules/pyexpat.c
parent0185f34ddcf07b78feb6ac666fbfd4615d26b028 (diff)
downloadcpython-cb5778f00ce48631c7140f33ba242496aaf7102b.zip
cpython-cb5778f00ce48631c7140f33ba242496aaf7102b.tar.gz
cpython-cb5778f00ce48631c7140f33ba242496aaf7102b.tar.bz2
bpo-34623: Use XML_SetHashSalt in _elementtree (GH-9146)
The C accelerated _elementtree module now initializes hash randomization salt from _Py_HashSecret instead of libexpat's default CPRNG. Signed-off-by: Christian Heimes <christian@python.org> https://bugs.python.org/issue34623
Diffstat (limited to 'Modules/pyexpat.c')
-rw-r--r--Modules/pyexpat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index c8a01d4..c52079e 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -1877,6 +1877,11 @@ MODULE_INITFUNC(void)
capi.SetStartDoctypeDeclHandler = XML_SetStartDoctypeDeclHandler;
capi.SetEncoding = XML_SetEncoding;
capi.DefaultUnknownEncodingHandler = PyUnknownEncodingHandler;
+#if XML_COMBINED_VERSION >= 20100
+ capi.SetHashSalt = XML_SetHashSalt;
+#else
+ capi.SetHashSalt = NULL;
+#endif
/* export using capsule */
capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL);