A simple example to reproduce:
{{{
from django.db.models import F
item = F('test')
for i in range(300):
item += F('test')
print(item)
}}}
returns
{{{
Traceback (most recent call last):
File "/usr/lib/python3.7/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 5, in <module>
File "/home/vagrant/venv/lib/python3.7/site-
packages/django/db/models/expressions.py", line 404, in __str__
return "{} {} {}".format(self.lhs, self.connector, self.rhs)
File "/home/vagrant/venv/lib/python3.7/site-
packages/django/db/models/expressions.py", line 404, in __str__
return "{} {} {}".format(self.lhs, self.connector, self.rhs)
File "/home/vagrant/venv/lib/python3.7/site-
packages/django/db/models/expressions.py", line 404, in __str__
return "{} {} {}".format(self.lhs, self.connector, self.rhs)
[Previous line repeated 244 more times]
RecursionError: maximum recursion depth exceeded
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30487>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* version: 2.1 => master
* resolution: => wontfix
Comment:
Thanks for the report, however `CombinedExpression` has a recursive
"nature" from the very beginning. IMO we will not be able to fix this with
current implementation. You can increase a Python's recursion limit
locally, e.g.
{{{
>>> import sys
>>> sys.setrecursionlimit(2000)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30487#comment:1>