Author smarnach
Recipients benjamin.peterson, petri.lehtinen, pitrou, smarnach
Date 2011-11-03.17:34:47
SpamBayes Score 1.18995e-11
Marked as misclassified No
Message-id <1320341688.19.0.908675994058.issue13332@psf.upfronthosting.co.za>
In-reply-to
Content
Getting the general case right seems a bit too difficult.  Examples like

    [execfile(n) for n in names if condition(n)]

    execfile(execfile(n1) or n2)

    try: 1 / 0
    except execfile(n) or ZeroDivisionError: pass

would require rather complex transformations to get exactly matching behaviour, and obviously we don't want to explode the fixer code to support such nonsense.

I think it is enough to cover the case of an execfile() call that forms a statement of its own.  Browsing through the first ten pages of a Google code search for "execfile" didn't reveal any other uses, except for a few that aren't covered by the current version of the fixer either. [1]

I'd suggest to simply throw a "could not convert" warning for any other uses of execfile().  Opinions?

[1]: http://www.google.com/codesearch#yqvQ9RM69FY/mercurial/lsprof.py&q=execfile&sq=&l=111&ct=rc&cd=49
History
Date User Action Args
2011-11-03 17:34:48smarnachsetrecipients: + smarnach, pitrou, benjamin.peterson, petri.lehtinen
2011-11-03 17:34:48smarnachsetmessageid: <1320341688.19.0.908675994058.issue13332@psf.upfronthosting.co.za>
2011-11-03 17:34:47smarnachlinkissue13332 messages
2011-11-03 17:34:47smarnachcreate