s-leroux / fin

Set of tools for personal investment
MIT License
1 stars 0 forks source link

Infinite recursion with `Table.add_column` #10

Open s-leroux opened 1 year ago

s-leroux commented 1 year ago

The code below produces an infinite recursion:

t = table.Table(361)
t.add_column((range))
  File "/home/sylvain/fin/fin/seq/table.py", line 322, in reval_item
    return self.reval(*it)
  File "/home/sylvain/fin/fin/seq/table.py", line 304, in reval
    result += self.reval(tail)
  File "/home/sylvain/fin/fin/seq/table.py", line 302, in reval
    result = self.reval_item(head)
  File "/home/sylvain/fin/fin/seq/table.py", line 322, in reval_item
    return self.reval(*it)
  File "/home/sylvain/fin/fin/seq/table.py", line 302, in reval
    result = self.reval_item(head)
  File "/home/sylvain/fin/fin/seq/table.py", line 324, in reval_item
    return [ Column(None, [item]*self._rows) ]
RecursionError: maximum recursion depth exceeded while calling a Python object

It is not obvious if add_column should accept the range function as a valid argument. Nevertheless, it shouldn't produce an infinite recursion.

s-leroux commented 3 months ago

Is this still an issue with the new sequence implementation introduced with v0.2.0?