summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Modules/binascii.c6
-rw-r--r--Modules/mpzmodule.c7
-rw-r--r--Modules/nismodule.c2
-rw-r--r--Modules/pcremodule.c4
-rw-r--r--Modules/posixmodule.c6
-rw-r--r--Modules/regexmodule.c6
-rw-r--r--Modules/socketmodule.c2
-rw-r--r--Modules/stdwinmodule.c12
-rw-r--r--Modules/stropmodule.c26
9 files changed, 34 insertions, 37 deletions
diff --git a/Modules/binascii.c b/Modules/binascii.c
index 295ff74b1b..26e4b6c755 100644
--- a/Modules/binascii.c
+++ b/Modules/binascii.c
@@ -213,7 +213,7 @@ binascii_a2b_uu(self, args)
PyObject *rv;
int ascii_len, bin_len;
- if ( !PyArg_ParseTuple(args, "s#", &ascii_data, &ascii_len) )
+ if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &ascii_len) )
return NULL;
/* First byte: binary data length (in bytes) */
@@ -343,7 +343,7 @@ binascii_a2b_base64(self, args)
PyObject *rv;
int ascii_len, bin_len;
- if ( !PyArg_ParseTuple(args, "s#", &ascii_data, &ascii_len) )
+ if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &ascii_len) )
return NULL;
bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */
@@ -457,7 +457,7 @@ binascii_a2b_hqx(self, args)
int len;
int done = 0;
- if ( !PyArg_ParseTuple(args, "s#", &ascii_data, &len) )
+ if ( !PyArg_ParseTuple(args, "t#", &ascii_data, &len) )
return NULL;
/* Allocate a string that is too big (fixed later) */
diff --git a/Modules/mpzmodule.c b/Modules/mpzmodule.c
index 0400605ed6..4299f454b7 100644
--- a/Modules/mpzmodule.c
+++ b/Modules/mpzmodule.c
@@ -969,12 +969,9 @@ MPZ_mpz(self, args)
mpz_clear(&mplongdigit);
}
else if (PyString_Check(objp)) {
- char *cp;
- int len;
+ char *cp = PyString_AS_STRING(objp);
+ int len = PyString_GET_SIZE(objp);
MP_INT mplongdigit;
-
- if (!PyArg_Parse(objp, "s#", &cp, &len))
- return NULL;
if ((mpzp = newmpzobject()) == NULL)
return NULL;
diff --git a/Modules/nismodule.c b/Modules/nismodule.c
index d99daeb0d4..fcd64ffe31 100644
--- a/Modules/nismodule.c
+++ b/Modules/nismodule.c
@@ -106,7 +106,7 @@ nis_match (self, args)
int err;
PyObject *res;
- if (!PyArg_Parse(args, "(s#s)", &key, &keylen, &map))
+ if (!PyArg_Parse(args, "(t#s)", &key, &keylen, &map))
return NULL;
if ((err = yp_get_default_domain(&domain)) != 0)
return nis_error(err);
diff --git a/Modules/pcremodule.c b/Modules/pcremodule.c
index f8bde04360..9819fdde15 100644
--- a/Modules/pcremodule.c
+++ b/Modules/pcremodule.c
@@ -111,11 +111,11 @@ PyPcre_exec(self, args)
int offsets[100*2];
PyObject *list;
- if (!PyArg_ParseTuple(args, "s#|iiii", &string, &stringlen, &pos, &endpos, &options))
+ if (!PyArg_ParseTuple(args, "t#|iiii", &string, &stringlen, &pos, &endpos, &options))
return NULL;
if (endpos == -1) {endpos = stringlen;}
count = pcre_exec(self->regex, self->regex_extra,
- (char *)string, endpos, pos, options,
+ string, endpos, pos, options,
offsets, sizeof(offsets)/sizeof(int) );
/* If an error occurred during the match, and an exception was raised,
just return NULL and leave the exception alone. The most likely
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index e6143e5f9a..876522b93a 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -612,7 +612,7 @@ posix_listdir(self, args)
WIN32_FIND_DATA FileData;
char namebuf[MAX_PATH+5];
- if (!PyArg_Parse(args, "s#", &name, &len))
+ if (!PyArg_Parse(args, "t#", &name, &len))
return NULL;
if (len >= MAX_PATH) {
PyErr_SetString(PyExc_ValueError, "path too long");
@@ -673,7 +673,7 @@ posix_listdir(self, args)
char namebuf[MAX_PATH+5];
struct _find_t ep;
- if (!PyArg_Parse(args, "s#", &name, &len))
+ if (!PyArg_Parse(args, "t#", &name, &len))
return NULL;
if (len >= MAX_PATH) {
PyErr_SetString(PyExc_ValueError, "path too long");
@@ -738,7 +738,7 @@ posix_listdir(self, args)
FILEFINDBUF3 ep;
APIRET rc;
- if (!PyArg_Parse(args, "s#", &name, &len))
+ if (!PyArg_Parse(args, "t#", &name, &len))
return NULL;
if (len >= MAX_PATH) {
PyErr_SetString(PyExc_ValueError, "path too long");
diff --git a/Modules/regexmodule.c b/Modules/regexmodule.c
index 7a289d5c4e..afc772264d 100644
--- a/Modules/regexmodule.c
+++ b/Modules/regexmodule.c
@@ -121,7 +121,7 @@ regobj_match(re, args)
if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset))
return NULL;
- if (!PyArg_Parse(argstring, "s#", &buffer, &size))
+ if (!PyArg_Parse(argstring, "t#", &buffer, &size))
return NULL;
if (offset < 0 || offset > size) {
@@ -160,7 +160,7 @@ regobj_search(re, args)
if (!PyArg_ParseTuple(args, "O|i", &argstring, &offset))
return NULL;
- if (!PyArg_Parse(argstring, "s#", &buffer, &size))
+ if (!PyArg_Parse(argstring, "t#", &buffer, &size))
return NULL;
if (offset < 0 || offset > size) {
@@ -410,7 +410,7 @@ newregexobject(pattern, translate, givenpat, groupindex)
char *pat;
int size;
- if (!PyArg_Parse(pattern, "s#", &pat, &size))
+ if (!PyArg_Parse(pattern, "t#", &pat, &size))
return NULL;
if (translate != NULL && PyString_Size(translate) != 256) {
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e195389041..9d672a64a6 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -472,7 +472,7 @@ getsockaddrarg,PySocketSockObject *,s, PyObject *,args, struct sockaddr **,addr_
char *path;
int len;
addr = (struct sockaddr_un* )&(s->sock_addr).un;
- if (!PyArg_Parse(args, "s#", &path, &len))
+ if (!PyArg_Parse(args, "t#", &path, &len))
return 0;
if (len > sizeof addr->sun_path) {
PyErr_SetString(PySocket_Error,
diff --git a/Modules/stdwinmodule.c b/Modules/stdwinmodule.c
index c24b3ef64d..a272047443 100644
--- a/Modules/stdwinmodule.c
+++ b/Modules/stdwinmodule.c
@@ -546,7 +546,7 @@ drawing_text(dp, args)
{
int h, v, size;
char *text;
- if (!PyArg_Parse(args, "((ii)s#)", &h, &v, &text, &size))
+ if (!PyArg_Parse(args, "((ii)t#)", &h, &v, &text, &size))
return NULL;
wdrawtext(h, v, text, size);
Py_INCREF(Py_None);
@@ -582,7 +582,7 @@ drawing_textwidth(dp, args)
{
char *text;
int size;
- if (!PyArg_Parse(args, "s#", &text, &size))
+ if (!PyArg_Parse(args, "t#", &text, &size))
return NULL;
return PyInt_FromLong((long)wtextwidth(text, size));
}
@@ -594,7 +594,7 @@ drawing_textbreak(dp, args)
{
char *text;
int size, width;
- if (!PyArg_Parse(args, "(s#i)", &text, &size, &width))
+ if (!PyArg_Parse(args, "(t#i)", &text, &size, &width))
return NULL;
return PyInt_FromLong((long)wtextbreak(text, size, width));
}
@@ -1056,7 +1056,7 @@ text_settext(self, args)
char *text;
char *buf;
int size;
- if (!PyArg_Parse(args, "s#", &text, &size))
+ if (!PyArg_Parse(args, "t#", &text, &size))
return NULL;
if ((buf = PyMem_NEW(char, size)) == NULL) {
return PyErr_NoMemory();
@@ -1809,7 +1809,7 @@ window_setselection(self, args)
{
int sel, size, ok;
char *text;
- if (!PyArg_Parse(args, "(is#)", &sel, &text, &size))
+ if (!PyArg_Parse(args, "(it#)", &sel, &text, &size))
return NULL;
ok = wsetselection(self->w_win, sel, text, size);
return PyInt_FromLong(ok);
@@ -2320,7 +2320,7 @@ stdwin_setcutbuffer(self, args)
{
int i, size;
char *str;
- if (!PyArg_Parse(args, "(is#)", &i, &str, &size))
+ if (!PyArg_Parse(args, "(it#)", &i, &str, &size))
return NULL;
wsetcutbuffer(i, str, size);
Py_INCREF(Py_None);
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index 85cab10267..3921d3460e 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -141,7 +141,7 @@ strop_splitfields(self, args)
n = 0;
splitcount = 0;
maxsplit = 0;
- if (!PyArg_ParseTuple(args, "s#|z#i", &s, &len, &sub, &n, &maxsplit))
+ if (!PyArg_ParseTuple(args, "t#|z#i", &s, &len, &sub, &n, &maxsplit))
return NULL;
if (sub == NULL)
return split_whitespace(s, len, maxsplit);
@@ -211,7 +211,7 @@ strop_joinfields(self, args)
char* p = NULL;
intargfunc getitemfunc;
- if (!PyArg_ParseTuple(args, "O|s#", &seq, &sep, &seplen))
+ if (!PyArg_ParseTuple(args, "O|t#", &seq, &sep, &seplen))
return NULL;
if (sep == NULL) {
sep = " ";
@@ -337,7 +337,7 @@ strop_find(self, args)
char *s, *sub;
int len, n, i = 0, last = INT_MAX;
- if (!PyArg_ParseTuple(args, "s#s#|ii", &s, &len, &sub, &n, &i, &last))
+ if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last))
return NULL;
if (last > len)
@@ -382,7 +382,7 @@ strop_rfind(self, args)
int len, n, j;
int i = 0, last = INT_MAX;
- if (!PyArg_ParseTuple(args, "s#s#|ii", &s, &len, &sub, &n, &i, &last))
+ if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last))
return NULL;
if (last > len)
@@ -417,7 +417,7 @@ do_strip(args, striptype)
int len, i, j;
- if (!PyArg_Parse(args, "s#", &s, &len))
+ if (!PyArg_Parse(args, "t#", &s, &len))
return NULL;
i = 0;
@@ -502,7 +502,7 @@ strop_lower(self, args)
PyObject *new;
int changed;
- if (!PyArg_Parse(args, "s#", &s, &n))
+ if (!PyArg_Parse(args, "t#", &s, &n))
return NULL;
new = PyString_FromStringAndSize(NULL, n);
if (new == NULL)
@@ -542,7 +542,7 @@ strop_upper(self, args)
PyObject *new;
int changed;
- if (!PyArg_Parse(args, "s#", &s, &n))
+ if (!PyArg_Parse(args, "t#", &s, &n))
return NULL;
new = PyString_FromStringAndSize(NULL, n);
if (new == NULL)
@@ -583,7 +583,7 @@ strop_capitalize(self, args)
PyObject *new;
int changed;
- if (!PyArg_Parse(args, "s#", &s, &n))
+ if (!PyArg_Parse(args, "t#", &s, &n))
return NULL;
new = PyString_FromStringAndSize(NULL, n);
if (new == NULL)
@@ -634,7 +634,7 @@ strop_count(self, args)
int i = 0, last = INT_MAX;
int m, r;
- if (!PyArg_ParseTuple(args, "s#s#|ii", &s, &len, &sub, &n, &i, &last))
+ if (!PyArg_ParseTuple(args, "t#t#|ii", &s, &len, &sub, &n, &i, &last))
return NULL;
if (last > len)
last = len;
@@ -679,7 +679,7 @@ strop_swapcase(self, args)
PyObject *new;
int changed;
- if (!PyArg_Parse(args, "s#", &s, &n))
+ if (!PyArg_Parse(args, "t#", &s, &n))
return NULL;
new = PyString_FromStringAndSize(NULL, n);
if (new == NULL)
@@ -877,7 +877,7 @@ strop_maketrans(self, args)
int i, fromlen=0, tolen=0;
PyObject *result;
- if (!PyArg_ParseTuple(args, "s#s#", &from, &fromlen, &to, &tolen))
+ if (!PyArg_ParseTuple(args, "t#t#", &from, &fromlen, &to, &tolen))
return NULL;
if (fromlen != tolen) {
@@ -920,7 +920,7 @@ strop_translate(self, args)
PyObject *result;
int trans_table[256];
- if (!PyArg_ParseTuple(args, "Ss#|s#", &input_obj,
+ if (!PyArg_ParseTuple(args, "St#|t#", &input_obj,
&table1, &tablen, &del_table, &dellen))
return NULL;
if (tablen != 256) {
@@ -1134,7 +1134,7 @@ strop_replace(self, args)
int count = 0;
PyObject *new;
- if (!PyArg_ParseTuple(args, "s#s#s#|i",
+ if (!PyArg_ParseTuple(args, "t#t#t#|i",
&str, &len, &pat, &pat_len, &sub, &sub_len,
&count))
return NULL;