classification
Title: 2to3 reapplies fix_dict
Type: behavior Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: benjamin.peterson Nosy List: benjamin.peterson, gboutsioukis
Priority: normal Keywords:

Created on 2010-07-30 19:28 by gboutsioukis, last changed 2010-08-08 21:00 by benjamin.peterson. This issue is now closed.

Messages (5)
msg112099 - (view) Author: George Boutsioukis (gboutsioukis) (Python committer) Date: 2010-07-30 19:28
This only happens on somewhat complex files, I haven't been able yet to isolate the source of this but here goes:

For django trunk, running 2to3 on django/contrib/admin/options.py yields the following:

@@ -282,7 +282,7 @@
         if self.declared_fieldsets:
             return self.declared_fieldsets
         form = self.get_form(request, obj)
-        fields = [..].keys() + list([...])
+        fields = list(list([...]keys())) + list([...])

instead of

+        fields = list([...].keys()) + etc.

and there are a couple of more instances in the same file.

However running 2to3 on the single line above, out of the file gives the correct result. This is only an issue with the fix_dict fixer.
msg113215 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-07 22:46
I don't experience this with the bleeding-edge version of 2to3. Can you try with that?
msg113309 - (view) Author: George Boutsioukis (gboutsioukis) (Python committer) Date: 2010-08-08 20:16
Tried it on 2 machines(Debian & Ubuntu) with both the sandbox and py3k versions. Maybe my setup is tainted on both, I'll try to find a clean one and try again from scratch.

Meanwhile, can you/someone pipe 2to3's output for the whole django trunk to grep list\(list\( and see if anything comes out?

(BTW in my output there are also instances of .itervalues() & .iterkeys() becoming list(...values/keys()) which is somewhat less benign)
msg113310 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-08 20:20
Ah ha. I found one.
msg113320 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-08-08 21:00
And fixed in r83857.
History
Date User Action Args
2010-08-08 21:00:20benjamin.petersonsetstatus: open -> closed
resolution: fixed
2010-08-08 21:00:02benjamin.petersonsetmessages: + msg113320
2010-08-08 20:20:49benjamin.petersonsetstatus: closed -> open
resolution: out of date -> (no value)
messages: + msg113310
2010-08-08 20:16:50gboutsioukissetmessages: + msg113309
2010-08-07 22:46:43benjamin.petersonsetstatus: open -> closed
resolution: out of date
messages: + msg113215
2010-07-31 11:44:51georg.brandlsetassignee: benjamin.peterson

nosy: + benjamin.peterson
2010-07-30 19:28:19gboutsioukiscreate