#17014: prefetch_related infinite recursion by default managers
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  nobody
         Type:  Bug                  |                   Status:  closed
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:  fixed
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  1
    Has patch:  0                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by akaariai):

 Two things about the patch:

  1. I really think you should add a MAX_PREFETCH_CALLS to
 db/models/query.py, and check len(done_lookups) against that. This is just
 for safety.
  2. This could be tested with a default manager like:

 {{{
 class DefManager:
     num_calls = 0
     def get_query_set(self):
         if DefManager.num_calls > 100:
             raise Exception('Recursion detected')
         DefManager.num_calls += 1
         return ...
 }}}
    This should make it safe to test this. Also, I think having a
 production machine taken down is worse than having a developers machine
 taken down.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17014#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to