From 2e3b896bedbc7a9abd16bf22d62503123454ed5a6f385b5c9b673bf723369bb1 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 20 May 2022 09:29:57 +0000 Subject: [PATCH] - Add 304_python310-crash.patch fixing crash of test test_001741 on Python 3.10 (gh#kurtmckee/feedparser#304). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-feedparser?expand=0&rev=60 --- 304_python310-crash.patch | 34 ++++++++++++++++++++++++++++++++++ python-feedparser.changes | 6 ++++++ python-feedparser.spec | 8 ++++---- 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 304_python310-crash.patch diff --git a/304_python310-crash.patch b/304_python310-crash.patch new file mode 100644 index 0000000..6ec755a --- /dev/null +++ b/304_python310-crash.patch @@ -0,0 +1,34 @@ +From c55bd8ad37db89bd219783bc514d600c9523ed38 Mon Sep 17 00:00:00 2001 +From: Kurt McKee +Date: Sat, 12 Jun 2021 15:32:05 -0500 +Subject: [PATCH] Fix a crash that occurs with Python 3.10.0b2 + +--- + changelog.d/20210612_152233_kurtmckee_python3_10.rst | 4 ++++ + feedparser/html.py | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + create mode 100644 changelog.d/20210612_152233_kurtmckee_python3_10.rst + +diff --git a/changelog.d/20210612_152233_kurtmckee_python3_10.rst b/changelog.d/20210612_152233_kurtmckee_python3_10.rst +new file mode 100644 +index 00000000..3795cdc0 +--- /dev/null ++++ b/changelog.d/20210612_152233_kurtmckee_python3_10.rst +@@ -0,0 +1,4 @@ ++Fixed ++----- ++ ++* Fix a crash that occurs with Python 3.10.0b2. +diff --git a/feedparser/html.py b/feedparser/html.py +index be913311..f78270a3 100644 +--- a/feedparser/html.py ++++ b/feedparser/html.py +@@ -337,7 +337,7 @@ def parse_declaration(self, i): + + try: + return sgmllib.SGMLParser.parse_declaration(self, i) +- except sgmllib.SGMLParseError: ++ except (AssertionError, sgmllib.SGMLParseError): + # Escape the doctype declaration and continue parsing. + self.handle_data('<') + return i+1 diff --git a/python-feedparser.changes b/python-feedparser.changes index e7570ee..5e291bd 100644 --- a/python-feedparser.changes +++ b/python-feedparser.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri May 20 09:28:16 UTC 2022 - Matej Cepl + +- Add 304_python310-crash.patch fixing crash of test test_001741 + on Python 3.10 (gh#kurtmckee/feedparser#304). + ------------------------------------------------------------------- Thu May 19 19:30:30 UTC 2022 - BenoƮt Monin diff --git a/python-feedparser.spec b/python-feedparser.spec index 1b48c83..903cd6f 100644 --- a/python-feedparser.spec +++ b/python-feedparser.spec @@ -26,15 +26,18 @@ License: BSD-2-Clause Group: Development/Libraries/Python URL: https://github.com/kurtmckee/feedparser Source: https://files.pythonhosted.org/packages/source/f/feedparser/feedparser-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 304_python310-crash.patch gh#kurtmckee/feedparser#304 mcepl@suse.com +# Fix crash on Python 3.10 +Patch0: 304_python310-crash.patch BuildRequires: %{python_module chardet} BuildRequires: %{python_module setuptools} BuildRequires: %{python_module sgmllib3k} BuildRequires: %{python_module xml} BuildRequires: fdupes BuildRequires: python-rpm-macros +Requires: python-sgmllib3k Requires: python-xml Recommends: python-chardet -Requires: python-sgmllib3k BuildArch: noarch %python_subpackages @@ -45,9 +48,6 @@ A universal feed parser module for Python that handles RSS 0.9x, RSS 1.0, RSS %prep %autosetup -p1 -n feedparser-%{version} -# Remove Python 3.10 non-compatible tests -rm -v tests/wellformed/sanitize/xml_declaration_unexpected_character.xml - # Make tests more verbose sed -i -e 's/verbosity=1/verbosity=2/' tests/runtests.py