#23982: Migrations produced under Python 2 require fixing when run under Python
3
-----------------------------------------+------------------------
Reporter: spookylukey | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
The basic problem is that Python 2 produces migrations like this:
{{{
#!python
fields=[
('name', models.CharField(max_length=255,
verbose_name=b'First Name', blank=True)),
],
}}}
while Python 3 like this:
{{{
#!python
fields=[
('name', models.CharField(max_length=255,
verbose_name='First Name', blank=True)),
],
}}}
(i.e. notice the lack of `b` prefix)
If you run 'makemigrations' under Python 3, with migrations made in the
first way, it creates a new migration to fix the field.
I've attached a script that shows the problem. I've tested it against
master as well as Django 1.7.1 and the bug is still present. A nice unit
test for this might not be possible.
There are two things to consider:
1. Fixing the generator so that it doesn't produce this problem
2. Fixing the migration code so that it doesn't consider this a problem.
Otherwise, going forward, all migrations created with 1.7 and 1.7.1 will
produce confusion when people use Python 3, even if we fix 1.
This bug manifests itself most obviously when running makemigrations with
3rd party apps. It looks like we were lucky when it came to the migrations
bundled with Django - perhaps they were created by Python 3?
--
Ticket URL: <https://code.djangoproject.com/ticket/23982>
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/054.7dd87d8bd12eca04148693711c09f7c5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.