Skip to content

Commit d4d1217

Browse files
committed
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: bastikr#121
1 parent 431e522 commit d4d1217

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

boolean/boolean.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,12 @@ def __lt__(self, other):
866866
def __gt__(self, other):
867867
lt = other.__lt__(self)
868868
if lt is NotImplemented:
869-
return not self.__lt__(other)
869+
self_lt = self.__lt__(other)
870+
if type(self_lt) is type(NotImplemented):
871+
# `return not NotImplemented`` no longer works in Python 3.14
872+
return False
873+
else:
874+
return not self_lt
870875
return lt
871876

872877
def __and__(self, other):

0 commit comments

Comments
 (0)