diff options
author | Guido van Rossum <guido@python.org> | 2000-12-01 12:59:05 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-12-01 12:59:05 (GMT) |
commit | 60a1e7fc9982489f6923371b1080818ead44db4a (patch) | |
tree | f6b7752f198eda47819e8ca3ae99e9ceb81d6376 | |
parent | 9940b800a497463fb4c1144c3738cfcec41cdaea (diff) | |
download | cpython-60a1e7fc9982489f6923371b1080818ead44db4a.zip cpython-60a1e7fc9982489f6923371b1080818ead44db4a.tar.gz cpython-60a1e7fc9982489f6923371b1080818ead44db4a.tar.bz2 |
Clarified some of the error messages, esp. "read-only character
buffer" replaced by "string or read-only character buffer".
-rw-r--r-- | Python/getargs.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/Python/getargs.c b/Python/getargs.c index 46251ae..b947a0c 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -565,7 +565,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) arg = _PyUnicode_AsDefaultEncodedString( arg, NULL); if (arg == NULL) - return "unicode conversion error"; + return "(unicode conversion error)"; *p = PyString_AS_STRING(arg); *q = PyString_GET_SIZE(arg); } @@ -575,9 +575,9 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) if ( pb == NULL || pb->bf_getreadbuffer == NULL || pb->bf_getsegcount == NULL ) - return "read-only buffer"; + return "string or read-only buffer"; if ( (*pb->bf_getsegcount)(arg, NULL) != 1 ) - return "single-segment read-only buffer"; + return "string or single-segment read-only buffer"; if ( (count = (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 ) return "(unspecified)"; @@ -593,7 +593,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) arg = _PyUnicode_AsDefaultEncodedString( arg, NULL); if (arg == NULL) - return "unicode conversion error"; + return "(unicode conversion error)"; *p = PyString_AS_STRING(arg); } else @@ -622,7 +622,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) arg = _PyUnicode_AsDefaultEncodedString( arg, NULL); if (arg == NULL) - return "unicode conversion error"; + return "(unicode conversion error)"; *p = PyString_AS_STRING(arg); *q = PyString_GET_SIZE(arg); } @@ -632,9 +632,9 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) if ( pb == NULL || pb->bf_getreadbuffer == NULL || pb->bf_getsegcount == NULL ) - return "read-only buffer"; + return "string or read-only buffer"; if ( (*pb->bf_getsegcount)(arg, NULL) != 1 ) - return "single-segment read-only buffer"; + return "string or single-segment read-only buffer"; if ( (count = (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 ) return "(unspecified)"; @@ -652,11 +652,11 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) arg = _PyUnicode_AsDefaultEncodedString( arg, NULL); if (arg == NULL) - return "unicode conversion error"; + return "(unicode conversion error)"; *p = PyString_AS_STRING(arg); } else - return "None or string"; + return "string or None"; if (*format == '#') { int *q = va_arg(*p_va, int *); if (arg == Py_None) @@ -667,7 +667,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) } else if (*p != NULL && (int)strlen(*p) != PyString_Size(arg)) - return "None or string without null bytes"; + return "string without null bytes or None"; } break; } @@ -695,7 +695,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) /* Convert object to Unicode */ u = PyUnicode_FromObject(arg); if (u == NULL) - return "string, unicode or text buffer"; + return "string or unicode or text buffer"; /* Encode object; use default error handling */ s = PyUnicode_AsEncodedString(u, @@ -773,8 +773,7 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) */ if ((int)strlen(PyString_AS_STRING(s)) != size) - return "(encoded string without "\ - "NULL bytes)"; + return "(encoded string without NULL bytes)"; *buffer = PyMem_NEW(char, size + 1); if (*buffer == NULL) { Py_DECREF(s); @@ -799,9 +798,9 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) if ( pb == NULL || pb->bf_getreadbuffer == NULL || pb->bf_getsegcount == NULL ) - return "read-only buffer"; + return "unicode or read-only buffer"; if ( (*pb->bf_getsegcount)(arg, NULL) != 1 ) - return "single-segment read-only buffer"; + return "unicode or single-segment read-only buffer"; if ( (count = (*pb->bf_getreadbuffer)(arg, 0, p)) < 0 ) return "(unspecified)"; @@ -916,9 +915,9 @@ convertsimple1(PyObject *arg, char **p_format, va_list *p_va) pb == NULL || pb->bf_getcharbuffer == NULL || pb->bf_getsegcount == NULL ) - return "read-only character buffer"; + return "string or read-only character buffer"; if ( (*pb->bf_getsegcount)(arg, NULL) != 1 ) - return "single-segment read-only buffer"; + return "string or single-segment read-only buffer"; if ( (count = pb->bf_getcharbuffer(arg, 0, p)) < 0 ) return "(unspecified)"; |