Skip to content

Commit 291e54b

Browse files
author
Release Manager
committed
gh-39174: Return True instead of None to avoid cachefunc being useless
Just a trivial fix. (probably just the tip of the iceberg though.) ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39174 Reported by: user202729 Reviewer(s): Martin Rubey
2 parents 4e3005d + 91cf51d commit 291e54b

File tree

3 files changed

+19
-15
lines changed

3 files changed

+19
-15
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=ebc4bd50c332f06ad5b2a4ce6217ec65790655ab
3-
sha256=a2fa7623b406a7937ebfbe3cc6d9e17bcf0c219dec2646320b7266326d789b56
2+
sha1=688c89dcc85f95d4637109c80decb8c7a66b8481
3+
sha256=3d46f808d4569dfcabb8c92dfb9ac8687f6fb0d1cf67cda71de79f9dc0c65b0f
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
a72ae6d615ddfd3e49b36c200aaf14c24a265916
1+
dc6e5545e0443748153c913364b47cca95feefa4

src/sage/combinat/integer_lists/invlex.pyx

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -860,14 +860,18 @@ If you know what you are doing, you can set check=False to skip this warning."""
860860
861861
OUTPUT:
862862
863-
``None`` if this method finds a proof that there
863+
``True`` if this method finds a proof that there
864864
exists an upper bound on the length. Otherwise a
865865
:exc:`ValueError` is raised.
866866
867+
Note that :func:`cached_method` does not work with methods
868+
returning ``None``, so ``True`` is returned instead.
869+
867870
EXAMPLES::
868871
869872
sage: L = IntegerListsLex(4, max_length=4)
870873
sage: L._check_finiteness()
874+
True
871875
872876
The following example is infinite::
873877
@@ -1002,20 +1006,20 @@ If you know what you are doing, you can set check=False to skip this warning."""
10021006
"""
10031007
# Trivial cases
10041008
if self.max_length < Infinity:
1005-
return
1009+
return True
10061010
if self.max_sum < self.min_sum:
1007-
return
1011+
return True
10081012
if self.min_slope > self.max_slope:
1009-
return
1013+
return True
10101014
if self.max_slope < 0:
1011-
return
1015+
return True
10121016
if self.ceiling.limit() < self.floor.limit():
1013-
return
1017+
return True
10141018
if self.ceiling.limit() == 0:
10151019
# This assumes no trailing zeroes
1016-
return
1020+
return True
10171021
if self.min_slope > 0 and self.ceiling.limit() < Infinity:
1018-
return
1022+
return True
10191023
10201024
# Compute a lower bound on the sum of floor(i) for i=1 to infinity
10211025
if self.floor.limit() > 0 or self.min_slope > 0:
@@ -1028,24 +1032,24 @@ If you know what you are doing, you can set check=False to skip this warning."""
10281032
floor_sum_lower_bound = Infinity
10291033
10301034
if self.max_sum < floor_sum_lower_bound:
1031-
return
1035+
return True
10321036
if self.max_sum == floor_sum_lower_bound and self.max_sum < Infinity:
10331037
# This assumes no trailing zeroes
1034-
return
1038+
return True
10351039
10361040
# Variant on ceiling.limit() ==0 where we actually discover that the ceiling limit is 0
10371041
if ( self.max_slope == 0 and
10381042
(self.max_sum < Infinity or
10391043
(self.ceiling.limit_start() < Infinity and
10401044
any(self.ceiling(i) == 0 for i in range(self.ceiling.limit_start()+1)))
10411045
) ):
1042-
return
1046+
return True
10431047
10441048
limit_start = max(self.ceiling.limit_start(), self.floor.limit_start())
10451049
if limit_start < Infinity:
10461050
for i in range(limit_start+1):
10471051
if self.ceiling(i) < self.floor(i):
1048-
return
1052+
return True
10491053
10501054
raise ValueError("could not prove that the specified constraints yield a finite set")
10511055

0 commit comments

Comments
 (0)