From ac1c6a8aae131dcc3af2e496cd7f27418da93fd8 Mon Sep 17 00:00:00 2001 From: Benjamin A. Beasley Date: Apr 26 2021 12:03:16 +0000 Subject: Patch for Python 3.10 compatibility (RHBZ#1953538, upstream issue #750) --- diff --git a/asyncpg-0.22.0-python3.10-test_invalid_input.patch b/asyncpg-0.22.0-python3.10-test_invalid_input.patch new file mode 100644 index 0000000..10a97bc --- /dev/null +++ b/asyncpg-0.22.0-python3.10-test_invalid_input.patch @@ -0,0 +1,42 @@ +diff -Naur asyncpg-0.22.0-original/tests/test_codecs.py asyncpg-0.22.0/tests/test_codecs.py +--- asyncpg-0.22.0-original/tests/test_codecs.py 2021-02-10 00:30:34.000000000 -0500 ++++ asyncpg-0.22.0/tests/test_codecs.py 2021-04-26 07:53:14.567038895 -0400 +@@ -670,6 +670,11 @@ + ''') + + async def test_invalid_input(self): ++ # The latter message appears beginning in Python 3.10. ++ integer_required = ( ++ "(an integer is required|" ++ "\('str' object cannot be interpreted as an integer\))") ++ + cases = [ + ('bytea', 'a bytes-like object is required', [ + 1, +@@ -678,7 +683,7 @@ + ('bool', 'a boolean is required', [ + 1, + ]), +- ('int2', 'an integer is required', [ ++ ('int2', integer_required, [ + '2', + 'aa', + ]), +@@ -694,7 +699,7 @@ + 4.1 * 10 ** 40, + -4.1 * 10 ** 40, + ]), +- ('int4', 'an integer is required', [ ++ ('int4', integer_required, [ + '2', + 'aa', + ]), +@@ -705,7 +710,7 @@ + 2**31, + -2**31 - 1, + ]), +- ('int8', 'an integer is required', [ ++ ('int8', integer_required, [ + '2', + 'aa', + ]), diff --git a/python-asyncpg.spec b/python-asyncpg.spec index ae76f5b..c7d2623 100644 --- a/python-asyncpg.spec +++ b/python-asyncpg.spec @@ -3,7 +3,7 @@ Name: python-%{srcname} Summary: A fast PostgreSQL Database Client Library for Python/asyncio Version: 0.22.0 -Release: 4%{?dist} +Release: 5%{?dist} License: ASL 2.0 URL: https://github.com/MagicStack/%{srcname} @@ -12,6 +12,11 @@ Source0: %{pypi_source} Source1: https://raw.githubusercontent.com/MagicStack/%{srcname}/v%{version}/docs/Makefile Source2: https://raw.githubusercontent.com/MagicStack/%{srcname}/v%{version}/docs/_static/theme_overrides.css +# A different error message than the tests expect appears in one case on Python +# 3.10. See https://github.com/MagicStack/asyncpg/issues/750. This patch is +# https://github.com/MagicStack/asyncpg/pull/751. +Patch0: %{srcname}-0.22.0-python3.10-test_invalid_input.patch + BuildRequires: gcc BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros @@ -72,7 +77,7 @@ BuildArch: noarch %prep -%autosetup -n %{srcname}-%{version} +%autosetup -n %{srcname}-%{version} -p1 rm -rvf %{srcname}.egg-info # Remove pre-generated C sources from Cython to ensure they are re-generated @@ -173,6 +178,9 @@ k='not TestFlake8' %changelog +* Mon Apr 26 2021 Benjamin A. Beasley - 0.22.0-5 +- Patch for Python 3.10 compatibility (RHBZ#1953538, upstream issue #750) + * Tue Mar 30 2021 Benjamin A. Beasley - 0.22.0-4 - Use pyproject-rpm-macros for build and install, too - More complete documentation build