comparison 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
comparison
equal deleted inserted replaced
72243:c49474f7f986 72244:1ad7e71ebd5f
609 return obj2ast_object(obj, out, arena); 609 return obj2ast_object(obj, out, arena);
610 } 610 }
611 611
612 static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) 612 static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
613 { 613 {
614 if (!PyUnicode_CheckExact(obj)) { 614 if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
615 PyErr_SetString(PyExc_TypeError, "AST string must be of type str"); 615 PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
616 return 1; 616 return 1;
617 } 617 }
618 return obj2ast_object(obj, out, arena); 618 return obj2ast_object(obj, out, arena);
619 } 619 }