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:
parent
c0969ee227
commit
0cb4062482
|
@ -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])
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue