summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-23 05:39:47 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-23 05:39:47 (GMT)
commite98ccf66902f10ce2daaa33a22fb8ee8d99de18f (patch)
tree41e520b10ee42e64e198c6aef48c3f397f1d7e13 /Lib/test
parent4d073bb9a1f72383e0ba78356a09c3799b41add6 (diff)
downloadcpython-e98ccf66902f10ce2daaa33a22fb8ee8d99de18f.zip
cpython-e98ccf66902f10ce2daaa33a22fb8ee8d99de18f.tar.gz
cpython-e98ccf66902f10ce2daaa33a22fb8ee8d99de18f.tar.bz2
Forward port MvL's fix in 43227:
Fix crash when a Unicode string containing an encoding declaration is compile()d. Fixes #1115379.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_compile.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index 1d47f91..72c4f7e 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -284,6 +284,10 @@ if 1:
f1, f2 = f()
self.assertNotEqual(id(f1.func_code), id(f2.func_code))
+ def test_unicode_encoding(self):
+ code = u"# -*- coding: utf-8 -*-\npass\n"
+ self.assertRaises(SyntaxError, compile, code, "tmp", "exec")
+
def test_subscripts(self):
# SF bug 1448804
# Class to make testing subscript results easy