accept bytes for the AST 'string' type
This is a temporary kludge and all is well in 3.3.
This commit is contained in:
parent
89b7af1e53
commit
4058211e8d
|
@ -13,6 +13,9 @@ Core and Builtins
|
||||||
- Issue #12326: sys.platform is now always 'linux2' on Linux, even if Python
|
- Issue #12326: sys.platform is now always 'linux2' on Linux, even if Python
|
||||||
is compiled on Linux 3.
|
is compiled on Linux 3.
|
||||||
|
|
||||||
|
- Accept bytes for the AST string type. This is temporary until a proper fix in
|
||||||
|
3.3.
|
||||||
|
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
|
|
@ -805,7 +805,7 @@ static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
|
||||||
|
|
||||||
static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
|
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");
|
PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -611,7 +611,7 @@ static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
|
||||||
|
|
||||||
static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
|
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");
|
PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue