Add patch for Python 3.8 support
https://github.com/tiran/defusedxml/pull/35
This commit is contained in:
@@ -19,6 +19,7 @@ Summary: XML bomb protection for Python stdlib modules
|
||||
License: Python
|
||||
URL: https://github.com/tiran/defusedxml
|
||||
Source0: https://files.pythonhosted.org/packages/source/d/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
|
||||
Patch1: %{url}/pull/35/commits/730872cc3a8a4467e9c7fa07063bfa9b20a790c5.patch#/python38.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
@@ -81,7 +82,7 @@ module. This is the python%{python3_other_pkgversion} build.
|
||||
%endif # with_python3
|
||||
|
||||
%prep
|
||||
%setup -q -n %{pypi_name}-%{version}
|
||||
%autosetup -p1 -n %{pypi_name}-%{version}
|
||||
|
||||
%build
|
||||
%py2_build
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
From 730872cc3a8a4467e9c7fa07063bfa9b20a790c5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|
||||
Date: Wed, 10 Apr 2019 13:56:16 +0200
|
||||
Subject: [PATCH] Handle Python 3.8 XMLParser html argument removal
|
||||
|
||||
Fixes https://github.com/tiran/defusedxml/issues/34
|
||||
---
|
||||
defusedxml/ElementTree.py | 10 +++++++---
|
||||
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/defusedxml/ElementTree.py b/defusedxml/ElementTree.py
|
||||
index 41b2ea8..5c49c4e 100644
|
||||
--- a/defusedxml/ElementTree.py
|
||||
+++ b/defusedxml/ElementTree.py
|
||||
@@ -61,11 +61,15 @@ def _get_py3_cls():
|
||||
|
||||
class DefusedXMLParser(_XMLParser):
|
||||
|
||||
- def __init__(self, html=0, target=None, encoding=None,
|
||||
+ def __init__(self, html=None, target=None, encoding=None,
|
||||
forbid_dtd=False, forbid_entities=True,
|
||||
forbid_external=True):
|
||||
- # Python 2.x old style class
|
||||
- _XMLParser.__init__(self, html, target, encoding)
|
||||
+ # Since Python 3.8, the html argument is not supported,
|
||||
+ # so we only pass it when we got it - the TypeError will propagate
|
||||
+ if html is None:
|
||||
+ _XMLParser.__init__(self, target=target, encoding=encoding)
|
||||
+ else:
|
||||
+ _XMLParser.__init__(self, html, target=target, encoding=encoding)
|
||||
self.forbid_dtd = forbid_dtd
|
||||
self.forbid_entities = forbid_entities
|
||||
self.forbid_external = forbid_external
|
||||
Reference in New Issue
Block a user