﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23770	"float(""inf"") as an argument to a validator breaks migrations"	w0rp	Markus Holtermann	"Deconstructing {{{float(""inf"")}}} in validator arguments breaks migrations, probably because {{{repr(float(""inf"")) == ""inf""}}}. A similar issue will exist for {{{float(""nan"")}}}.

To reproduce this, you'll need a validator using deconstructible.

{{{#!python
from django.utils.deconstruct import deconstructible

@deconstructible
class DoNothingValidator (object):
    def __init__(self, foo):
        self.foo = foo

    def __call__(self, value):
        pass

    def __eq__(self, other):
        return type(self) == type(other) \
        and self.foo == other.foo
}}}

Now you'll need to pass the validator with float(""inf"") to a field.

{{{#!python
class SomeModel (Model):
    some_field = IntegerField(
        validators= [DoNothingValidator(float(""inf""))],
    )
}}}

Now if you run 'makemigrations', you will get output like the following.

{{{#!python
...
('some_field', models.IntegerField(validators=[some.path.DoNothingValidator(inf)])),
...
}}}

The {{{inf}}} above will cause a NameError when you attempt to migrate, or when you create further migrations with 'makemigrations' again."	Bug	closed	Migrations	dev	Release blocker	fixed		info+coding@…	Ready for checkin	1	0	0	0	0	0
