[New-bugs-announce] [issue10588] imp.find_module raises unexpected SyntaxError

Emile Anclin report at bugs.python.org
Tue Nov 30 10:35:52 CET 2010

New submission from Emile Anclin <emile.anclin at logilab.fr>:

Considering following file: 
$ cat pylint/test/input/func_unknown_encoding.py 
# -*- coding: IBO-8859-1 -*-
""" check correct unknown encoding declaration

__revision__ = 'éééé'

When we try to find that module, imp.find_module raises SyntaxError:

>>> 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

It should be considered as a bug, as stated by  Brett Cannon:

> 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.

messages: 122896
nosy: emile.anclin
priority: normal
severity: normal
status: open
title: imp.find_module raises unexpected SyntaxError
type: behavior
versions: Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list