Opened 4 years ago

Closed 4 years ago

#26928 closed defect (duplicate)

matrix argument parsing eats all the memory instead of rising an error

Reported by: Thierry Monteil Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: linear algebra Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


It has been reported on this ask question, here is a minimal example:


Change History (3)

comment:1 Changed 4 years ago by Nils Bruin

Why is this a bug? ZZ is an iterable, as you can see from

sage: I=iter(ZZ)
sage: [next(I) for i in [1..10]]
[0, 1, -1, 2, -2, 3, -3, 4, -4, 5]

so the user is asking to construct a matrix with one row and countably infinitely many columns. If there would be a way to tell that an iterator is infinite, we could raise an error, but python does not provide such functionality (thanks to the stopping problem). We can't really do anything about this. It does seem appropriate that matrix accepts an iterable that produces iterables.

comment:2 Changed 4 years ago by Jeroen Demeyer

I consider this a duplicate of the more general #24757

comment:3 Changed 4 years ago by Jeroen Demeyer

Milestone: sage-8.6sage-duplicate/invalid/wontfix
Resolution: duplicate
Status: newclosed
Note: See TracTickets for help on using tickets.