mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Refs #27149 -- Based recursive nested subquery detection on sys.getrecursionlimit().
This makes sure the test_avoid_infinite_loop_on_too_many_subqueries test doesn't fail on systems with a non-default recursion limit.
This commit is contained in:
parent
9ac8520fcd
commit
c0969ee227
2 changed files with 9 additions and 3 deletions
|
@ -1,5 +1,6 @@
|
|||
import datetime
|
||||
import pickle
|
||||
import sys
|
||||
import unittest
|
||||
from operator import attrgetter
|
||||
|
||||
|
@ -402,10 +403,10 @@ class Queries1Tests(TestCase):
|
|||
|
||||
def test_avoid_infinite_loop_on_too_many_subqueries(self):
|
||||
x = Tag.objects.filter(pk=1)
|
||||
local_recursion_limit = 67
|
||||
local_recursion_limit = sys.getrecursionlimit() // 16
|
||||
msg = 'Maximum recursion depth exceeded: too many subqueries.'
|
||||
with self.assertRaisesMessage(RuntimeError, msg):
|
||||
for i in range(local_recursion_limit * 2):
|
||||
for i in range(local_recursion_limit + 2):
|
||||
x = Tag.objects.filter(pk__in=x)
|
||||
|
||||
def test_reasonable_number_of_subq_aliases(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue