Author: Armin Rigo <[email protected]>
Branch: py3.6
Changeset: r96894:58a21b8e9445
Date: 2019-07-01 13:41 +0200
http://bitbucket.org/pypy/pypy/changeset/58a21b8e9445/
Log: hg merge 9831511d5e3e (step-by-step merging with default)
diff --git a/pypy/interpreter/pyparser/pyparse.py
b/pypy/interpreter/pyparser/pyparse.py
--- a/pypy/interpreter/pyparser/pyparse.py
+++ b/pypy/interpreter/pyparser/pyparse.py
@@ -121,7 +121,7 @@
# If an encoding is explicitly given check that it is utf-8.
decl_enc = _check_for_encoding(bytessrc)
explicit_encoding = (decl_enc is not None)
- if decl_enc and decl_enc != "utf-8":
+ if decl_enc and _normalize_encoding(decl_enc) != "utf-8":
raise error.SyntaxError("UTF-8 BOM with %s coding cookie" %
decl_enc,
filename=compile_info.filename)
textsrc = bytessrc
diff --git a/pypy/interpreter/pyparser/test/test_pyparse.py
b/pypy/interpreter/pyparser/test/test_pyparse.py
--- a/pypy/interpreter/pyparser/test/test_pyparse.py
+++ b/pypy/interpreter/pyparser/test/test_pyparse.py
@@ -57,6 +57,8 @@
input = "\xEF\xBB\xBF# coding: latin-1\nx"
exc = py.test.raises(SyntaxError, self.parse, input).value
assert exc.msg == "UTF-8 BOM with latin-1 coding cookie"
+ input = "\xEF\xBB\xBF# coding: UtF-8-yadda-YADDA\nx"
+ self.parse(input) # this does not raise
input = "# coding: not-here"
exc = py.test.raises(SyntaxError, self.parse, input).value
assert exc.msg == "Unknown encoding: not-here"
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit