You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
python-boolean.py/SOURCES/122.patch

61 lines
2.0 KiB

From d4d12173f6b90e346bfe6a21bb95d6ba2a9dd73b Mon Sep 17 00:00:00 2001
From: Lumir Balhar <lbalhar@redhat.com>
Date: Mon, 11 Nov 2024 14:12:13 +0100
Subject: [PATCH 1/2] Workaround incompatibility with Python 3.14
Using NotImplemented in a boolean context will now raise
a TypeError. It had previously raised a DeprecationWarning since
Python 3.9.
Fixes: https://github.com/bastikr/boolean.py/issues/121
---
boolean/boolean.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/boolean/boolean.py b/boolean/boolean.py
index eeffbc4..8685d4e 100644
--- a/boolean/boolean.py
+++ b/boolean/boolean.py
@@ -866,7 +866,12 @@ def __lt__(self, other):
def __gt__(self, other):
lt = other.__lt__(self)
if lt is NotImplemented:
- return not self.__lt__(other)
+ self_lt = self.__lt__(other)
+ if type(self_lt) is type(NotImplemented):
+ # `return not NotImplemented`` no longer works in Python 3.14
+ return False
+ else:
+ return not self_lt
return lt
def __and__(self, other):
From e43539f421f0da674b491f769aa678dc42d8f87b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lum=C3=ADr=20=27Frenzy=27=20Balhar?=
<frenzy.madness@gmail.com>
Date: Mon, 11 Nov 2024 16:15:18 +0100
Subject: [PATCH 2/2] Update boolean/boolean.py
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Miro Hrončok <miro@hroncok.cz>
---
boolean/boolean.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boolean/boolean.py b/boolean/boolean.py
index 8685d4e..cd4bdbe 100644
--- a/boolean/boolean.py
+++ b/boolean/boolean.py
@@ -867,7 +867,7 @@ def __gt__(self, other):
lt = other.__lt__(self)
if lt is NotImplemented:
self_lt = self.__lt__(other)
- if type(self_lt) is type(NotImplemented):
+ if self_lt is NotImplemented:
# `return not NotImplemented`` no longer works in Python 3.14
return False
else: