This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年11月30日 09:35 by emile.anclin, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg122896 - (view) | Author: Emile Anclin (emile.anclin) | Date: 2010年11月30日 09:35 | |
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.
|
|||
| msg141883 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2011年08月10日 20:23 | |
The reason for this is that file_module tries to detect the encoding of the file to set the encoding for the opened file. IMO, it should just return a file in binary mode. |
|||
| msg180613 - (view) | Author: Brett Cannon (brett.cannon) * (Python committer) | Date: 2013年01月25日 19:31 | |
imp.find_module() is now documented as deprecated, so changing the mode that files are opened in would change backwards-compatibility but wouldn't be worth it. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:09 | admin | set | github: 54797 |
| 2013年01月25日 19:31:04 | brett.cannon | set | status: open -> closed messages: + msg180613 resolution: out of date nosy: brett.cannon, ncoghlan, vstinner, ron_adam, benjamin.peterson, eric.araujo, Arfrever, Trundle, skrah, emile.anclin |
| 2011年09月25日 19:35:03 | Arfrever | set | nosy:
+ Arfrever |
| 2011年08月10日 20:23:13 | benjamin.peterson | set | nosy:
+ benjamin.peterson, vstinner messages: + msg141883 |
| 2011年08月10日 18:59:31 | Trundle | set | nosy:
+ Trundle |
| 2011年08月09日 22:50:23 | skrah | set | nosy:
+ skrah |
| 2010年12月05日 23:58:13 | eric.araujo | set | nosy:
+ brett.cannon, ncoghlan, eric.araujo |
| 2010年11月30日 15:33:30 | ron_adam | set | nosy:
+ ron_adam |
| 2010年11月30日 09:35:46 | emile.anclin | create | |