summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xParser/asdl_c.py2
-rw-r--r--Python/Python-ast.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 0b95aaa1e8..c66082eb02 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -807,7 +807,7 @@ static int obj2ast_identifier(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");
return 1;
}
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index f6e345c916..ff79757c35 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -604,7 +604,7 @@ static int obj2ast_identifier(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");
return 1;
}