summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-21 18:35:52 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-21 18:35:52 (GMT)
commit7bdff2c8e5c648f42ee2b196e320288053dfd53b (patch)
treef94e068c43078bb67cf97261529c8e176ccab396 /Lib
parent8123ef2ec02f34f838d58744a7c54c43be2f3568 (diff)
downloadcpython-7bdff2c8e5c648f42ee2b196e320288053dfd53b.zip
cpython-7bdff2c8e5c648f42ee2b196e320288053dfd53b.tar.gz
cpython-7bdff2c8e5c648f42ee2b196e320288053dfd53b.tar.bz2
Issue #1882: when compiling code from a string, encoding cookies in the
second line of code were not always recognized correctly. (backport from rev. 60168)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_pep263.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/test/test_pep263.py b/Lib/test/test_pep263.py
index 3b09c12..1a85f3b 100644
--- a/Lib/test/test_pep263.py
+++ b/Lib/test/test_pep263.py
@@ -1,5 +1,5 @@
#! -*- coding: koi8-r -*-
-# This file is marked as binary in the CVS, to prevent MacCVS from recoding it.
+# This file is marked as binary in SVN, to prevent MacCVS from recoding it.
import unittest
from test import test_support
@@ -16,6 +16,14 @@ class PEP263Test(unittest.TestCase):
'\\\xd0\x9f'
)
+ def test_compilestring(self):
+ # see #1882
+ c = compile("\n# coding: utf-8\nu = u'\xc3\xb3'\n", "dummy", "exec")
+ d = {}
+ exec c in d
+ self.assertEqual(d['u'], u'\xf3')
+
+
def test_main():
test_support.run_unittest(PEP263Test)