Skip to content

Commit 47cb1e1

Browse files
author
Noel Roemmele
committed
Fixed issue where Partitions() was caching results when an error happens.
1 parent 766c7a0 commit 47cb1e1

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/sage/combinat/partition.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7596,8 +7596,19 @@ def __classcall_private__(cls, n, parts):
75967596
sage: P2 = Partitions(4, parts_in=(1,2))
75977597
sage: P is P2
75987598
True
7599+
7600+
Ensure that :issue:`38640` is fixed::
7601+
7602+
sage: list(Partitions(4,parts_in=vector(QQ,[2,4])))
7603+
[[4], [2, 2]]
7604+
sage: list(Partitions(4,parts_in=vector(QQ,[2,1/4])))
7605+
Traceback (most recent call last):
7606+
...
7607+
TypeError: no conversion of this rational to integer
7608+
sage: list(Partitions(4,parts_in=vector(ZZ,[2,4])))
7609+
[[4], [2, 2]]
75997610
"""
7600-
parts = tuple(sorted(parts))
7611+
parts = tuple(sorted(map(ZZ,parts)))
76017612
return super().__classcall__(cls, Integer(n), parts)
76027613

76037614
def __init__(self, n, parts):

0 commit comments

Comments
 (0)