Forward port MvL's fix in 43227:

Fix crash when a Unicode string containing an encoding declaration is
compile()d. Fixes #1115379.
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 @@
         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