diff --git a/python-random2.changes b/python-random2.changes index 10925d8..7e177f0 100644 --- a/python-random2.changes +++ b/python-random2.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Apr 17 06:37:03 UTC 2021 - Christophe Giboudeaux + +- Add patch from Debian to fix build with python 3.9: + * python3.9.patch + ------------------------------------------------------------------- Mon Oct 14 14:40:23 UTC 2019 - Matej Cepl diff --git a/python-random2.spec b/python-random2.spec index 247271d..23e50ee 100644 --- a/python-random2.spec +++ b/python-random2.spec @@ -25,6 +25,8 @@ Summary: A Session and Caching library with WSGI Middleware License: Python-2.0 URL: https://pypi.python.org/pypi/random2 Source: https://files.pythonhosted.org/packages/source/r/random2/random2-%{version}.zip +# PATCH-FIX-UPSTREAM -- python3.9.patch Origin: Debian +Patch0: python3.9.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -45,7 +47,7 @@ makes porting code to Python 3 a lot harder, if all those tests have to be adjusted. This package fixes that. %prep -%setup -q -n random2-%{version} +%autosetup -p1 -n random2-%{version} %build %python_build diff --git a/python3.9.patch b/python3.9.patch new file mode 100644 index 0000000..ea0096c --- /dev/null +++ b/python3.9.patch @@ -0,0 +1,31 @@ +Description: fix tests with python 3.9 + Python docs for the function being tested now state: + "Changed in version 3.9: This method now accepts zero for k." + https://docs.python.org/3/library/random.html#random.getrandbits +Author: Juhani Numminen +Bug-Debian: https://bugs.debian.org/973085 +Last-Update: 2020-11-24 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/tests.py ++++ b/src/tests.py +@@ -291,7 +291,8 @@ + # Verify argument checking + self.assertRaises(TypeError, self.gen.getrandbits) + self.assertRaises(TypeError, self.gen.getrandbits, 1, 2) +- self.assertRaises(ValueError, self.gen.getrandbits, 0) ++ if sys.version_info < (3, 9): ++ self.assertRaises(ValueError, self.gen.getrandbits, 0) + self.assertRaises(ValueError, self.gen.getrandbits, -1) + self.assertRaises(TypeError, self.gen.getrandbits, 10.1) + +@@ -448,7 +449,8 @@ + self.assertRaises(TypeError, self.gen.getrandbits) + self.assertRaises(TypeError, self.gen.getrandbits, 'a') + self.assertRaises(TypeError, self.gen.getrandbits, 1, 2) +- self.assertRaises(ValueError, self.gen.getrandbits, 0) ++ if sys.version_info < (3, 9): ++ self.assertRaises(ValueError, self.gen.getrandbits, 0) + self.assertRaises(ValueError, self.gen.getrandbits, -1) + + def test_randbelow_logic(self, _log=log, int=int):