summaryrefslogtreecommitdiffstats
path: root/Objects/bytesobject.c
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-10-21 12:29:12 (GMT)
committerGitHub <noreply@github.com>2018-10-21 12:29:12 (GMT)
commit2c2044e789875ea736ec42e216fdbe61816fbe28 (patch)
tree0dd0b52b1167f07473c0c5c13f2a519ac8c06afb /Objects/bytesobject.c
parent914f9a078f997e58cfcfabcbb30fafdd1f277bef (diff)
downloadcpython-2c2044e789875ea736ec42e216fdbe61816fbe28.zip
cpython-2c2044e789875ea736ec42e216fdbe61816fbe28.tar.gz
cpython-2c2044e789875ea736ec42e216fdbe61816fbe28.tar.bz2
bpo-34984: Improve error messages for bytes and bytearray constructors. (GH-9874)
Diffstat (limited to 'Objects/bytesobject.c')
-rw-r--r--Objects/bytesobject.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c
index d1057b9..c412393 100644
--- a/Objects/bytesobject.c
+++ b/Objects/bytesobject.c
@@ -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);