From 48c9f9aa16fb2711b5ed4532200f22e3b8ba03f7ff9c5767af615ea9bb7d68a6 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Tue, 4 Jul 2023 23:45:07 +0000 Subject: [PATCH] REmove unnecessary patch. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-exceptiongroup?expand=0&rev=15 --- 64_handl_embed_excep.patch | 98 ----------------------------------- python-exceptiongroup.changes | 2 - python-exceptiongroup.spec | 3 -- 3 files changed, 103 deletions(-) delete mode 100644 64_handl_embed_excep.patch diff --git a/64_handl_embed_excep.patch b/64_handl_embed_excep.patch deleted file mode 100644 index c24c947..0000000 --- a/64_handl_embed_excep.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 821d5ebaadfd0b5b16c785a942f69e89933217bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Alex=20Gr=C3=B6nholm?= -Date: Mon, 3 Jul 2023 00:54:13 +0300 -Subject: [PATCH] Changed handling of a single exception raised in exception - group handlers to match Python 3.11.4 - -Fixes #64. ---- - CHANGES.rst | 6 ++++++ - src/exceptiongroup/_catch.py | 5 ++++- - tests/test_catch.py | 8 +------- - tests/test_catch_py311.py | 8 +------- - 4 files changed, 12 insertions(+), 15 deletions(-) - -diff --git a/CHANGES.rst b/CHANGES.rst -index 31831a3..3c2b08f 100644 ---- a/CHANGES.rst -+++ b/CHANGES.rst -@@ -3,6 +3,12 @@ Version history - - This library adheres to `Semantic Versioning 2.0 `_. - -+**UNRELEASED** -+ -+- Changed handling of exceptions in exception group handler callbacks to not wrap a -+ single exception in an exception group, as per -+ `CPython issue 103590 `_ -+ - **1.1.1** - - - Worked around -diff --git a/src/exceptiongroup/_catch.py b/src/exceptiongroup/_catch.py -index aa16d16..0be39b4 100644 ---- a/src/exceptiongroup/_catch.py -+++ b/src/exceptiongroup/_catch.py -@@ -37,7 +37,7 @@ def __exit__( - - return False - -- def handle_exception(self, exc: BaseException) -> BaseExceptionGroup | None: -+ def handle_exception(self, exc: BaseException) -> BaseException | None: - excgroup: BaseExceptionGroup | None - if isinstance(exc, BaseExceptionGroup): - excgroup = exc -@@ -57,6 +57,9 @@ def handle_exception(self, exc: BaseException) -> BaseExceptionGroup | None: - break - - if new_exceptions: -+ if len(new_exceptions) == 1: -+ return new_exceptions[0] -+ - if excgroup: - new_exceptions.append(excgroup) - -diff --git a/tests/test_catch.py b/tests/test_catch.py -index bc520b9..0af2fa0 100644 ---- a/tests/test_catch.py -+++ b/tests/test_catch.py -@@ -148,15 +148,9 @@ def test_catch_handler_raises(): - def handler(exc): - raise RuntimeError("new") - -- try: -+ with pytest.raises(RuntimeError, match="new"): - with catch({(ValueError, ValueError): handler}): - raise ExceptionGroup("booboo", [ValueError("bar")]) -- except ExceptionGroup as exc: -- assert exc.message == "" -- assert len(exc.exceptions) == 1 -- assert isinstance(exc.exceptions[0], RuntimeError) -- else: -- pytest.fail("Did not raise an ExceptionGroup") - - - def test_catch_subclass(): -diff --git a/tests/test_catch_py311.py b/tests/test_catch_py311.py -index cc161e7..4351be8 100644 ---- a/tests/test_catch_py311.py -+++ b/tests/test_catch_py311.py -@@ -122,17 +122,11 @@ def test_catch_full_match(): - - - def test_catch_handler_raises(): -- try: -+ with pytest.raises(RuntimeError, match="new"): - try: - raise ExceptionGroup("booboo", [ValueError("bar")]) - except* ValueError: - raise RuntimeError("new") -- except ExceptionGroup as exc: -- assert exc.message == "" -- assert len(exc.exceptions) == 1 -- assert isinstance(exc.exceptions[0], RuntimeError) -- else: -- pytest.fail("Did not raise an ExceptionGroup") - - - def test_catch_subclass(): diff --git a/python-exceptiongroup.changes b/python-exceptiongroup.changes index 50e3b45..b28d82a 100644 --- a/python-exceptiongroup.changes +++ b/python-exceptiongroup.changes @@ -5,8 +5,6 @@ Tue Jul 4 22:32:27 UTC 2023 - Matej Cepl - Changed handling of exceptions in exception group handler callbacks to not wrap a single exception in an exception group, as per CPython issue gh#python/cpython#103590. -- Add 64_handl_embed_excep.patch fixing - gh#agronholm/exceptiongroup#64. ------------------------------------------------------------------- Fri Apr 21 12:24:46 UTC 2023 - Dirk Müller diff --git a/python-exceptiongroup.spec b/python-exceptiongroup.spec index dfe5128..402bdce 100644 --- a/python-exceptiongroup.spec +++ b/python-exceptiongroup.spec @@ -35,9 +35,6 @@ Summary: Backport of PEP 654 (exception groups) License: MIT AND Python-2.0 URL: https://github.com/agronholm/exceptiongroup Source: https://github.com/agronholm/exceptiongroup/archive/refs/tags/%{version}.tar.gz#/exceptiongroup-%{version}-gh.tar.gz -# PATCH-FIX-UPSTREAM 64_handl_embed_excep.patch gh#agronholm/exceptiongroup#64 mcepl@suse.com -# Changed handling of a single exception raised in exception -Patch0: 64_handl_embed_excep.patch BuildRequires: %{python_module base >= 3.7} BuildRequires: %{python_module flit-scm} BuildRequires: %{python_module pip}