Refs #23758 -- Used RecursionError instead of RuntimeError to raise nested subquery errors.

RecursionError was introduced in Python 3.5 and subclasses RuntimeError.
This commit is contained in:
Simon Charette 2019-04-05 00:40:54 -04:00 committed by Mariusz Felisiak
parent c0969ee227
commit 0cb4062482
2 changed files with 2 additions and 2 deletions

View File

@ -894,7 +894,7 @@ class Query(BaseExpression):
self.alias_prefix = prefix
break
if pos > local_recursion_limit:
raise RuntimeError(
raise RecursionError(
'Maximum recursion depth exceeded: too many subqueries.'
)
self.subq_aliases = self.subq_aliases.union([self.alias_prefix])

View File

@ -405,7 +405,7 @@ class Queries1Tests(TestCase):
x = Tag.objects.filter(pk=1)
local_recursion_limit = sys.getrecursionlimit() // 16
msg = 'Maximum recursion depth exceeded: too many subqueries.'
with self.assertRaisesMessage(RuntimeError, msg):
with self.assertRaisesMessage(RecursionError, msg):
for i in range(local_recursion_limit + 2):
x = Tag.objects.filter(pk__in=x)