Author: neal.norwitz
Date: Sat Aug 11 23:31:25 2007
New Revision: 56935

Modified:
   python/branches/py3k/Lib/test/test_coding.py
   python/branches/py3k/Parser/tokenizer.c
Log:
Fix problem when exec'ing a string with a coding

Modified: python/branches/py3k/Lib/test/test_coding.py
==============================================================================
--- python/branches/py3k/Lib/test/test_coding.py        (original)
+++ python/branches/py3k/Lib/test/test_coding.py        Sat Aug 11 23:31:25 2007
@@ -21,6 +21,11 @@
         fp.close()
         self.assertRaises(SyntaxError, compile, text, filename, 'exec')
 
+    def test_exec_valid_coding(self):
+        d = {}
+        exec('# coding: cp949\na = 5\n', d)
+        self.assertEqual(d['a'], 5)
+
 def test_main():
     test.test_support.run_unittest(CodingTest)
 

Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c     (original)
+++ python/branches/py3k/Parser/tokenizer.c     Sat Aug 11 23:31:25 2007
@@ -632,7 +632,7 @@
                                "unknown encoding: %s", tok->enc);
                        return error_ret(tok);
                }
-               str = PyString_AsString(utf8);
+               str = PyBytes_AsString(utf8);
        }
        assert(tok->decoding_buffer == NULL);
        tok->decoding_buffer = utf8; /* CAUTION */
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to