mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-34984: Improve error messages for bytes and bytearray constructors. (GH-9874)
This commit is contained in:
parent
914f9a078f
commit
2c2044e789
3 changed files with 25 additions and 6 deletions
|
@ -2537,8 +2537,9 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
|||
if (x == NULL) {
|
||||
if (encoding != NULL || errors != NULL) {
|
||||
PyErr_SetString(PyExc_TypeError,
|
||||
"encoding or errors without sequence "
|
||||
"argument");
|
||||
encoding != NULL ?
|
||||
"encoding without a string argument" :
|
||||
"errors without a string argument");
|
||||
return NULL;
|
||||
}
|
||||
return PyBytes_FromStringAndSize(NULL, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue