diff -r 2fe0b2dcc98c Objects/bytesobject.c --- a/Objects/bytesobject.c Tue Jan 21 15:36:51 2014 -0500 +++ b/Objects/bytesobject.c Tue Jan 21 23:10:32 2014 +0100 @@ -2557,6 +2557,13 @@ 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. */ @@ -2598,13 +2605,6 @@ 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); }