mirror of
https://github.com/python/cpython
synced 2024-10-06 12:57:41 +00:00
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
48e484fdde
commit
0224d4e699
|
@ -10,6 +10,9 @@ What's New in Python 3.2.3?
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Accept bytes for the AST string type. This is temporary until a proper fix in
|
||||||
|
3.3.
|
||||||
|
|
||||||
- Issue #9200: The str.is* methods now work with strings that contain non-BMP
|
- Issue #9200: The str.is* methods now work with strings that contain non-BMP
|
||||||
characters even in narrow Unicode builds.
|
characters even in narrow Unicode builds.
|
||||||
|
|
||||||
|
|
|
@ -805,7 +805,7 @@ def visitModule(self, mod):
|
||||||
|
|
||||||
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 a new issue