diff options
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/bytesobject.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 6dc9f13..a5b9feb 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -3039,6 +3039,13 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return new; } + /* If it's not unicode, there can't be encoding or errors */ + if (encoding != NULL || errors != NULL) { + PyErr_SetString(PyExc_TypeError, + "encoding or errors without a string argument"); + return NULL; + } + /* We'd like to call PyObject_Bytes here, but we need to check for an integer argument before deferring to PyBytes_FromObject, something PyObject_Bytes doesn't do. */ @@ -3078,13 +3085,6 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds) return new; } - /* If it's not unicode, there can't be encoding or errors */ - if (encoding != NULL || errors != NULL) { - PyErr_SetString(PyExc_TypeError, - "encoding or errors without a string argument"); - return NULL; - } - return PyBytes_FromObject(x); } |