diff --git a/boltons-pr271-py39-frozendict.patch b/boltons-pr271-py39-frozendict.patch new file mode 100644 index 0000000..13eaabf --- /dev/null +++ b/boltons-pr271-py39-frozendict.patch @@ -0,0 +1,62 @@ +From d9c2af2319339924092f7e503c9ebb6079956006 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +Date: Wed, 18 Nov 2020 13:12:49 +0000 +Subject: [PATCH] Fix Python 3.9 compatibility for FrozenDict due to PEP 584 + implementation. + +--- + boltons/dictutils.py | 2 +- + tests/test_dictutils.py | 12 ++++++++++++ + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/boltons/dictutils.py b/boltons/dictutils.py +index ce5884c..8d1a4e7 100644 +--- a/boltons/dictutils.py ++++ b/boltons/dictutils.py +@@ -1076,7 +1076,7 @@ def _raise_frozen_typeerror(self, *a, **kw): + "raises a TypeError, because FrozenDicts are immutable" + raise TypeError('%s object is immutable' % self.__class__.__name__) + +- __setitem__ = __delitem__ = update = _raise_frozen_typeerror ++ __ior__ = __setitem__ = __delitem__ = update = _raise_frozen_typeerror + setdefault = pop = popitem = clear = _raise_frozen_typeerror + + del _raise_frozen_typeerror +diff --git a/tests/test_dictutils.py b/tests/test_dictutils.py +index b6873a8..6eac812 100644 +--- a/tests/test_dictutils.py ++++ b/tests/test_dictutils.py +@@ -1,5 +1,6 @@ + # -*- coding: utf-8 -*- + ++import sys + import pytest + + from boltons.dictutils import OMD, OneToOne, ManyToMany, FrozenDict, subdict, FrozenHashError +@@ -432,6 +433,15 @@ def test_frozendict(): + return + + ++@pytest.mark.skipif(sys.version_info < (3, 9), reason="requires python3.9 or higher") ++def test_frozendict_ior(): ++ data = {'a': 'A', 'b': 'B'} ++ fd = FrozenDict(data) ++ ++ with pytest.raises(TypeError, match=".*FrozenDict.*immutable.*"): ++ fd |= fd ++ ++ + def test_frozendict_api(): + # all the read-only methods that are fine + through_methods = ['__class__', +@@ -452,8 +462,10 @@ def test_frozendict_api(): + '__lt__', + '__ne__', + '__new__', ++ '__or__', + '__reduce__', + '__reversed__', ++ '__ror__', + '__setattr__', + '__sizeof__', + '__str__', diff --git a/python-boltons.changes b/python-boltons.changes index 4aa9002..4dfc7b0 100644 --- a/python-boltons.changes +++ b/python-boltons.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Mar 19 19:53:55 UTC 2021 - Ben Greiner + +- Add boltons-pr271-py39-frozendict.patch + * gh#mahmoud/boltons#271 + * gh#mahmoud/boltons#283 + ------------------------------------------------------------------- Sat Jan 30 07:06:02 UTC 2021 - John Vandenberg diff --git a/python-boltons.spec b/python-boltons.spec index d77904e..fe762de 100644 --- a/python-boltons.spec +++ b/python-boltons.spec @@ -25,6 +25,8 @@ License: BSD-3-Clause Group: Development/Languages/Python URL: https://github.com/mahmoud/boltons Source: https://github.com/mahmoud/boltons/archive/%{version}.tar.gz#/boltons-%{version}.tar.gz +# PATCH-FIX-UPSTREAM boltons-pr271-py39-frozendict.patch -- gh#mahmoud/boltons#271, gh#mahmoud/boltons#283 +Patch0: boltons-pr271-py39-frozendict.patch BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -38,7 +40,7 @@ that can be used as a package or independently. Documentation is on http://boltons.readthedocs.org. %prep -%setup -q -n boltons-%{version} +%autosetup -p1 -n boltons-%{version} %build %python_build @@ -53,6 +55,7 @@ http://boltons.readthedocs.org. %files %{python_files} %license LICENSE %doc README.md CHANGELOG.md docs/*.rst -%{python_sitelib}/* +%{python_sitelib}/boltons +%{python_sitelib}/boltons-%{version}*-info %changelog