Opened 2 years ago

Closed 2 years ago

#26928 closed defect (duplicate)

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

Reported by: tmonteil 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

Description

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

matrix([ZZ])

Change History (3)

comment:1 Changed 2 years ago by nbruin

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 2 years ago by jdemeyer

I consider this a duplicate of the more general #24757

comment:3 Changed 2 years ago by jdemeyer

  • Milestone changed from sage-8.6 to sage-duplicate/invalid/wontfix
  • Resolution set to duplicate
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.