#23112: Field.get_choices tries to index an iterable
-------------------------------------+-------------------------------------
     Reporter:  bernie_sumption      |                    Owner:  areski
         Type:  Bug                  |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.7-rc-2
  (models, ORM)                      |               Resolution:
     Severity:  Release blocker      |             Triage Stage:  Accepted
     Keywords:                       |      Needs documentation:  0
    Has patch:  1                    |  Patch needs improvement:  0
  Needs tests:  0                    |                    UI/UX:  0
Easy pickings:  0                    |
-------------------------------------+-------------------------------------

Comment (by CollinAnderson):

 As noticed in #23119, the patch doesn't work if the iterable is empty
 (empty iterable is fine on 1.6)

 {{{
 field = models.CharField(choices=(x for x in []), blank=True,
 max_length=1)
 }}}

 raises `IndexError: list index out of range` with the pull request. No
 problem on 1.6

-- 
Ticket URL: <https://code.djangoproject.com/ticket/23112#comment:16>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/073.abb960c93e48867bba44b06cc8f6db72%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to