Skip to content

Commit

Permalink
Fix #75
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreDecan committed Jan 28, 2023
1 parent e49898c commit a5c2da8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# Changelog


## 2.3.1 (not yet released)
## 2.3.1 (2023-01-28)

### Changed
- Speed up lookups in `IntervalDict` for non-interval keys.
- Speed up `iterate` by no longer creating singleton instances under the hood.
- Drop official support for Python 3.6.

### Fixed
- Infinite recursion in `iterate` with `Interval` subclasses (see [#75](https://github.com/AlexandreDecan/portion/issues/75)).
- Infinite recursion when a subclass of an `Interval` is compared using `>` with an `Interval` instance (see [#75](https://github.com/AlexandreDecan/portion/issues/75)).



Expand Down
8 changes: 7 additions & 1 deletion portion/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,13 @@ def __lt__(self, other):

def __gt__(self, other):
if isinstance(other, Interval):
return other < self
if self.empty or other.empty:
return False

if self.left == Bound.OPEN or other.right == Bound.OPEN:
return self.lower >= other.upper
else:
return self.lower > other.upper
else:
warnings.warn(
"Comparing an interval and a value is deprecated. Convert value to singleton first.",
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setup(
name="portion",
version="2.3.1-pre1",
version="2.3.1",
license="LGPLv3",
author="Alexandre Decan",
url="https://github.com/AlexandreDecan/portion",
Expand All @@ -34,7 +34,7 @@
],
keywords="interval operation range math",
packages=find_packages(include=["portion"]),
python_requires="~= 3.6",
python_requires="~= 3.7",
install_requires=[
"sortedcontainers ~= 2.2",
],
Expand Down

0 comments on commit a5c2da8

Please sign in to comment.