diff Python/Python-ast.c @ 72244:1ad7e71ebd5f 3.2

accept bytes for the AST 'string' type This is a temporary kludge and all is well in 3.3.
author Benjamin Peterson <benjamin@python.org>
date Wed, 31 Aug 2011 22:13:03 -0400
parents c9ebae3285e3
children 470f7d7c57ce cfccc755c457
line wrap: on
line diff
--- a/Python/Python-ast.c	Sat Sep 03 09:08:49 2011 +0200
+++ b/Python/Python-ast.c	Wed Aug 31 22:13:03 2011 -0400
@@ -611,7 +611,7 @@
 
 static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
 {
-    if (!PyUnicode_CheckExact(obj)) {
+    if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
         PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
         return 1;
     }