[Python-porting] edge case
Brett Cannon
bcannon at gmail.com
Wed Mar 12 16:17:06 CET 2014
More information about the Python-porting mailing list
Wed Mar 12 16:17:06 CET 2014
- Previous message: [Python-porting] Caniusepython3
- Next message: [Python-porting] six 1.5.2 breaks calendar server 5.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I hope Ed is on this mailing list, but in case he isn't you might want to file an official bug at https://github.com/PythonCharmers/python-future . On Wed Mar 12 2014 at 7:24:49 AM, Mike Dewhirst <miked at dewhirst.com.au> wrote: > While porting a project - all modules at once - futurize threw a > traceback without contextual clues for which of my modules it found > problematic. > > Traceback (most recent call last): > ... (snipped) > File > "c:\users\miked\env\xxdx\lib\site-packages\libfuturize\fixer_util.py", > line 373, in check_future_import > assert 0, "strange import" > AssertionError: strange import > > > Rather than start again one module at a time I rummaged around line 373 > in fixer_util.py to see what it was trying to do. > > > I hacked it as follows: > > --- > C:/users/miked/env/xxdx/Lib/site-packages/libfuturize/fixer_util.py~ > Sat > Feb 15 09:33:01 2014 > +++ C:/users/miked/env/xxdx/Lib/site-packages/libfuturize/fixer_util.py > Sat Feb 15 09:33:17 2014 > @@ -341,6 +341,7 @@ def check_future_import(node): > """If this is a future import, return set of symbols that are > imported, > else return None.""" > # node should be the import statement here > + savenode = node > if not (node.type == syms.simple_stmt and node.children): > return set() > node = node.children[0] > @@ -370,6 +371,6 @@ def check_future_import(node): > elif node.type == token.NAME: > return set([node.value]) > else: > - assert 0, "strange import" > + assert 0, "strange import: %s" % savenode > > Then I ran futurize again and got a clue ... > > Traceback (most recent call last): > ... (snipped) > File > "c:\users\miked\env\xxdx\lib\site-packages\libfuturize\fixer_util.py", > line 374, in check_future_import > assert 0, "strange import: %s" % savenode > AssertionError: strange import: from __future__ import > (unicode_literals, division) > > > Whereupon I searched for the offending text and removed the parentheses > from the import line and all was well. > > Lovely software - thanks Ed > > Mike > _______________________________________________ > Python-porting mailing list > Python-porting at python.org > https://mail.python.org/mailman/listinfo/python-porting > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-porting/attachments/20140312/e4a47f86/attachment-0001.html>
- Previous message: [Python-porting] Caniusepython3
- Next message: [Python-porting] six 1.5.2 breaks calendar server 5.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-porting mailing list