Re: [Python-Dev] python3k : imp.find_module raises SyntaxError
On Monday 29 November 2010 20:22:22 Brett Cannon wrote: Considering these semantics changed between Python 2 and 3 w/o a discernable benefit (I would consider it a negative as finding a module should not be impacted by syntactic correctness; the full act of importing should be the only thing that cares about that), I would consider it a bug that should be filed. ok, here it is : http://bugs.python.org/issue10588 Since I did not understand all of it, I just quoted Brett Cannon in the ticket. -- Emile Anclin emile.anc...@logilab.fr http://www.logilab.fr/ http://www.logilab.org/ Informatique scientifique et gestion de connaissances ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] python3k : imp.find_module raises SyntaxError
hello, working on Pylint, we have a lot of voluntary corrupted files to test Pylint behavior; for instance $ cat /home/emile/var/pylint/test/input/func_unknown_encoding.py # -*- coding: IBO-8859-1 -*- check correct unknown encoding declaration __revision__ = '' and we try to find that module : find_module('func_unknown_encoding', None). But python3 raises SyntaxError in that case ; it didn't raise SyntaxError on python2 nor does so on our func_nonascii_noencoding and func_wrong_encoding modules (with obvious names) Python 3.2a2 (r32a2:84522, Sep 14 2010, 15:22:36) [GCC 4.3.4] on linux2 Type help, copyright, credits or license for more information. from imp import find_module find_module('func_unknown_encoding', None) Traceback (most recent call last): File stdin, line 1, in module SyntaxError: encoding problem: with BOM find_module('func_wrong_encoding', None) (_io.TextIOWrapper name=5 encoding='utf-8', 'func_wrong_encoding.py', ('.py', 'U', 1)) find_module('func_nonascii_noencoding', None) (_io.TextIOWrapper name=6 encoding='utf-8', 'func_nonascii_noencoding.py', ('.py', 'U', 1)) So what is the reason of this selective behavior? Furthermore, there is BOM in our func_unknown_encoding.py module. -- Emile Anclin emile.anc...@logilab.fr http://www.logilab.fr/ http://www.logilab.org/ Informatique scientifique et gestion de connaissances ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] python3k vs _ast
hello everybody, migrating Pylint to python3.x, we encounter a little problem : in the tree generated by _ast, if we consider a args node (representing an argument of a function), the lineno (and the col_offset) information disappeared from those nodes. Is there a particular reason for that ? In python2.x, the args nodes were just Name nodes, and as for now we keep them as AssName nodes in astng/pylint and would like to know where it was defined. thx for any information -- Emile Anclin emile.anc...@logilab.fr http://www.logilab.fr/ http://www.logilab.org/ Informatique scientifique et gestion de connaissances ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] python3k vs _ast
On Wednesday 17 November 2010 14:36:37 Benjamin Peterson wrote: I wouldn't object to adding them back if you want to file a bug report. Ok, thank you for quick reply. here is the issue : http://bugs.python.org/issue10445 -- Emile Anclin emile.anc...@logilab.fr http://www.logilab.fr/ http://www.logilab.org/ Informatique scientifique et gestion de connaissances ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com