summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2008-05-26 12:51:38 (GMT)
committerChristian Heimes <christian@cheimes.de>2008-05-26 12:51:38 (GMT)
commit593daf545bd9b7e7bcb27b498ecc6f36db9ae395 (patch)
treec0a57029b9ab0eb18a2bb4f8fd65f0817f1a1707 /Python/getargs.c
parentc3cb683d638e9d660c18a05293a576f98965166e (diff)
downloadcpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.zip
cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.gz
cpython-593daf545bd9b7e7bcb27b498ecc6f36db9ae395.tar.bz2
Renamed PyString to PyBytes
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 162cf6f..3b8950c 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -418,7 +418,7 @@ converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
n++;
}
- if (!PySequence_Check(arg) || PyString_Check(arg)) {
+ if (!PySequence_Check(arg) || PyBytes_Check(arg)) {
levels[0] = 0;
PyOS_snprintf(msgbuf, bufsize,
toplevel ? "expected %d arguments, not %.50s" :
@@ -765,8 +765,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'c': {/* char */
char *p = va_arg(*p_va, char *);
- if (PyString_Check(arg) && PyString_Size(arg) == 1)
- *p = PyString_AS_STRING(arg)[0];
+ if (PyBytes_Check(arg) && PyBytes_Size(arg) == 1)
+ *p = PyBytes_AS_STRING(arg)[0];
else
return converterr("char", arg, msgbuf, bufsize);
break;
@@ -777,9 +777,9 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
void **p = (void **)va_arg(*p_va, char **);
FETCH_SIZE;
- if (PyString_Check(arg)) {
- *p = PyString_AS_STRING(arg);
- STORE_SIZE(PyString_GET_SIZE(arg));
+ if (PyBytes_Check(arg)) {
+ *p = PyBytes_AS_STRING(arg);
+ STORE_SIZE(PyBytes_GET_SIZE(arg));
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(arg)) {
@@ -787,8 +787,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (uarg == NULL)
return converterr(CONV_UNICODE,
arg, msgbuf, bufsize);
- *p = PyString_AS_STRING(uarg);
- STORE_SIZE(PyString_GET_SIZE(uarg));
+ *p = PyBytes_AS_STRING(uarg);
+ STORE_SIZE(PyBytes_GET_SIZE(uarg));
}
#endif
else { /* any buffer-like object */
@@ -802,20 +802,20 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
} else {
char **p = va_arg(*p_va, char **);
- if (PyString_Check(arg))
- *p = PyString_AS_STRING(arg);
+ if (PyBytes_Check(arg))
+ *p = PyBytes_AS_STRING(arg);
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(arg)) {
uarg = UNICODE_DEFAULT_ENCODING(arg);
if (uarg == NULL)
return converterr(CONV_UNICODE,
arg, msgbuf, bufsize);
- *p = PyString_AS_STRING(uarg);
+ *p = PyBytes_AS_STRING(uarg);
}
#endif
else
return converterr("string", arg, msgbuf, bufsize);
- if ((Py_ssize_t)strlen(*p) != PyString_Size(arg))
+ if ((Py_ssize_t)strlen(*p) != PyBytes_Size(arg))
return converterr("string without null bytes",
arg, msgbuf, bufsize);
}
@@ -831,9 +831,9 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
*p = 0;
STORE_SIZE(0);
}
- else if (PyString_Check(arg)) {
- *p = PyString_AS_STRING(arg);
- STORE_SIZE(PyString_GET_SIZE(arg));
+ else if (PyBytes_Check(arg)) {
+ *p = PyBytes_AS_STRING(arg);
+ STORE_SIZE(PyBytes_GET_SIZE(arg));
}
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(arg)) {
@@ -841,8 +841,8 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (uarg == NULL)
return converterr(CONV_UNICODE,
arg, msgbuf, bufsize);
- *p = PyString_AS_STRING(uarg);
- STORE_SIZE(PyString_GET_SIZE(uarg));
+ *p = PyBytes_AS_STRING(uarg);
+ STORE_SIZE(PyBytes_GET_SIZE(uarg));
}
#endif
else { /* any buffer-like object */
@@ -858,15 +858,15 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (arg == Py_None)
*p = 0;
- else if (PyString_Check(arg))
- *p = PyString_AS_STRING(arg);
+ else if (PyBytes_Check(arg))
+ *p = PyBytes_AS_STRING(arg);
#ifdef Py_USING_UNICODE
else if (PyUnicode_Check(arg)) {
uarg = UNICODE_DEFAULT_ENCODING(arg);
if (uarg == NULL)
return converterr(CONV_UNICODE,
arg, msgbuf, bufsize);
- *p = PyString_AS_STRING(uarg);
+ *p = PyBytes_AS_STRING(uarg);
}
#endif
else
@@ -878,11 +878,11 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (arg == Py_None)
*q = 0;
else
- *q = PyString_Size(arg);
+ *q = PyBytes_Size(arg);
format++;
}
else if (*p != NULL &&
- (Py_ssize_t)strlen(*p) != PyString_Size(arg))
+ (Py_ssize_t)strlen(*p) != PyBytes_Size(arg))
return converterr(
"string without null bytes or None",
arg, msgbuf, bufsize);
@@ -923,7 +923,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
arg, msgbuf, bufsize);
/* Encode object */
- if (!recode_strings && PyString_Check(arg)) {
+ if (!recode_strings && PyBytes_Check(arg)) {
s = arg;
Py_INCREF(s);
}
@@ -946,7 +946,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
if (s == NULL)
return converterr("(encoding failed)",
arg, msgbuf, bufsize);
- if (!PyString_Check(s)) {
+ if (!PyBytes_Check(s)) {
Py_DECREF(s);
return converterr(
"(encoder failed to return a string)",
@@ -956,7 +956,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
return converterr("string<e>", arg, msgbuf, bufsize);
#endif
}
- size = PyString_GET_SIZE(s);
+ size = PyBytes_GET_SIZE(s);
/* Write output; output is guaranteed to be 0-terminated */
if (*format == '#') {
@@ -1013,7 +1013,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
}
}
memcpy(*buffer,
- PyString_AS_STRING(s),
+ PyBytes_AS_STRING(s),
size + 1);
STORE_SIZE(size);
} else {
@@ -1030,7 +1030,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
PyMem_Free()ing it after usage
*/
- if ((Py_ssize_t)strlen(PyString_AS_STRING(s))
+ if ((Py_ssize_t)strlen(PyBytes_AS_STRING(s))
!= size) {
Py_DECREF(s);
return converterr(
@@ -1049,7 +1049,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
arg, msgbuf, bufsize);
}
memcpy(*buffer,
- PyString_AS_STRING(s),
+ PyBytes_AS_STRING(s),
size + 1);
}
Py_DECREF(s);
@@ -1083,7 +1083,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
case 'S': { /* string object */
PyObject **p = va_arg(*p_va, PyObject **);
- if (PyString_Check(arg))
+ if (PyBytes_Check(arg))
*p = arg;
else
return converterr("string", arg, msgbuf, bufsize);
@@ -1473,12 +1473,12 @@ vgetargskeywords(PyObject *args, PyObject *keywords, const char *format,
while (PyDict_Next(keywords, &pos, &key, &value)) {
int match = 0;
char *ks;
- if (!PyString_Check(key)) {
+ if (!PyBytes_Check(key)) {
PyErr_SetString(PyExc_TypeError,
"keywords must be strings");
return cleanreturn(0, freelist);
}
- ks = PyString_AsString(key);
+ ks = PyBytes_AsString(key);
for (i = 0; i < len; i++) {
if (!strcmp(ks, kwlist[i])) {
match = 1;