Issue 18038: Unhelpful error message on invalid encoding specification (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/62238

classification

Title: Unhelpful error message on invalid encoding specification
Type: behavior Stage: resolved
Components: Interpreter Core, Unicode Versions: Python 3.3, Python 3.4, Python 2.7

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Max.Cantor, ezio.melotti, loewis, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2013-05-22 22:43 by Max.Cantor, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
tokenizer_encoding_problem_msg.patch serhiy.storchaka,2013-05-24 10:09 review
Messages (6)
msg189840 - (view) Author: Max Cantor (Max.Cantor) Date: 2013-05-22 22:43
When you specify a nonexistent encoding at the top of a file, like so for example: # -*- coding: fakefakefoobar -*- The following exception occurs: SyntaxError: encoding problem: with BOM This is very unhelpful, especially in cases where you might have made a typo in the encoding.
msg189846 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-23 04:31
Here is a patch.
msg189903 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2013-05-24 09:53
LGTM.
msg189905 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-24 10:09
Here is a better patch with tests (see also ).
msg190856 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-06-09 13:59
New changeset 15aa786b723b by Serhiy Storchaka in branch '3.3': Issue #18038: SyntaxError raised during compilation sources with illegal http://hg.python.org/cpython/rev/15aa786b723b New changeset 39e2f0059ee2 by Serhiy Storchaka in branch 'default': Issue #18038: SyntaxError raised during compilation sources with illegal http://hg.python.org/cpython/rev/39e2f0059ee2 New changeset 570b5b4040b1 by Serhiy Storchaka in branch '2.7': Issue #18038: SyntaxError raised during compilation sources with illegal http://hg.python.org/cpython/rev/570b5b4040b1
msg192075 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-06-30 15:51
New changeset 19bc00996e74 by R David Murray in branch '3.3': #18038: Use non-deprecated assert names in tests. http://hg.python.org/cpython/rev/19bc00996e74 New changeset 29e7f6a2dc0d by R David Murray in branch 'default': Null merge #18038: Use non-deprecated assert names in tests. http://hg.python.org/cpython/rev/29e7f6a2dc0d
History
Date User Action Args
2022-04-11 14:57:45 admin set github: 62238
2013-06-30 15:51:09 python-dev set messages: +
2013-06-09 14:13:49 serhiy.storchaka set status: open -> closedresolution: fixedstage: patch review -> resolved
2013-06-09 13:59:01 python-dev set nosy: + python-devmessages: +
2013-06-08 22:51:10 serhiy.storchaka set assignee: serhiy.storchaka
2013-05-24 11:54:36 serhiy.storchaka set files: - tokenizer_encoding_problem_msg.patch
2013-05-24 10:09:30 serhiy.storchaka set files: + tokenizer_encoding_problem_msg.patchmessages: +
2013-05-24 09:53:58 loewis set nosy: + loewismessages: +
2013-05-23 04:31:27 serhiy.storchaka set files: + tokenizer_encoding_problem_msg.patchcomponents: + Interpreter Core, Unicode, - Library (Lib)versions: + Python 3.3, Python 3.4keywords: + patchnosy: + serhiy.storchaka, ezio.melottimessages: + stage: patch review
2013-05-22 22:43:16 Max.Cantor create