Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html
Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:
test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec
This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
diff --git a/Modules/stropmodule.c b/Modules/stropmodule.c
index cffef3a..8b00fed 100644
--- a/Modules/stropmodule.c
+++ b/Modules/stropmodule.c
@@ -333,7 +333,7 @@
{
char *s, *sub;
Py_ssize_t len, n, j;
- Py_ssize_t i = 0, last = INT_MAX;
+ Py_ssize_t i = 0, last = PY_SSIZE_T_MAX;
WARN;
if (!PyArg_ParseTuple(args, "t#t#|nn:rfind", &s, &len, &sub, &n, &i, &last))
@@ -446,16 +446,16 @@
{
char *s, *s_new;
Py_ssize_t i, n;
- PyObject *new;
+ PyObject *newstr;
int changed;
WARN;
if (PyString_AsStringAndSize(args, &s, &n))
return NULL;
- new = PyString_FromStringAndSize(NULL, n);
- if (new == NULL)
+ newstr = PyString_FromStringAndSize(NULL, n);
+ if (newstr == NULL)
return NULL;
- s_new = PyString_AsString(new);
+ s_new = PyString_AsString(newstr);
changed = 0;
for (i = 0; i < n; i++) {
int c = Py_CHARMASK(*s++);
@@ -467,11 +467,11 @@
s_new++;
}
if (!changed) {
- Py_DECREF(new);
+ Py_DECREF(newstr);
Py_INCREF(args);
return args;
}
- return new;
+ return newstr;
}
@@ -485,16 +485,16 @@
{
char *s, *s_new;
Py_ssize_t i, n;
- PyObject *new;
+ PyObject *newstr;
int changed;
WARN;
if (PyString_AsStringAndSize(args, &s, &n))
return NULL;
- new = PyString_FromStringAndSize(NULL, n);
- if (new == NULL)
+ newstr = PyString_FromStringAndSize(NULL, n);
+ if (newstr == NULL)
return NULL;
- s_new = PyString_AsString(new);
+ s_new = PyString_AsString(newstr);
changed = 0;
for (i = 0; i < n; i++) {
int c = Py_CHARMASK(*s++);
@@ -506,11 +506,11 @@
s_new++;
}
if (!changed) {
- Py_DECREF(new);
+ Py_DECREF(newstr);
Py_INCREF(args);
return args;
}
- return new;
+ return newstr;
}
@@ -525,16 +525,16 @@
{
char *s, *s_new;
Py_ssize_t i, n;
- PyObject *new;
+ PyObject *newstr;
int changed;
WARN;
if (PyString_AsStringAndSize(args, &s, &n))
return NULL;
- new = PyString_FromStringAndSize(NULL, n);
- if (new == NULL)
+ newstr = PyString_FromStringAndSize(NULL, n);
+ if (newstr == NULL)
return NULL;
- s_new = PyString_AsString(new);
+ s_new = PyString_AsString(newstr);
changed = 0;
if (0 < n) {
int c = Py_CHARMASK(*s++);
@@ -555,11 +555,11 @@
s_new++;
}
if (!changed) {
- Py_DECREF(new);
+ Py_DECREF(newstr);
Py_INCREF(args);
return args;
}
- return new;
+ return newstr;
}
@@ -647,7 +647,7 @@
{
char *s, *sub;
Py_ssize_t len, n;
- Py_ssize_t i = 0, last = INT_MAX;
+ Py_ssize_t i = 0, last = PY_SSIZE_T_MAX;
Py_ssize_t m, r;
WARN;
@@ -691,16 +691,16 @@
{
char *s, *s_new;
Py_ssize_t i, n;
- PyObject *new;
+ PyObject *newstr;
int changed;
WARN;
if (PyString_AsStringAndSize(args, &s, &n))
return NULL;
- new = PyString_FromStringAndSize(NULL, n);
- if (new == NULL)
+ newstr = PyString_FromStringAndSize(NULL, n);
+ if (newstr == NULL)
return NULL;
- s_new = PyString_AsString(new);
+ s_new = PyString_AsString(newstr);
changed = 0;
for (i = 0; i < n; i++) {
int c = Py_CHARMASK(*s++);
@@ -717,11 +717,11 @@
s_new++;
}
if (!changed) {
- Py_DECREF(new);
+ Py_DECREF(newstr);
Py_INCREF(args);
return args;
}
- return new;
+ return newstr;
}
@@ -942,7 +942,7 @@
}
table = table1;
- inlen = PyString_Size(input_obj);
+ inlen = PyString_GET_SIZE(input_obj);
result = PyString_FromStringAndSize((char *)NULL, inlen);
if (result == NULL)
return NULL;
@@ -1078,7 +1078,7 @@
/* find length of output string */
nfound = mymemcnt(str, len, pat, pat_len);
if (count < 0)
- count = INT_MAX;
+ count = PY_SSIZE_T_MAX;
else if (nfound > count)
nfound = count;
if (nfound == 0)
@@ -1141,7 +1141,7 @@
char *str, *pat,*sub,*new_s;
Py_ssize_t len,pat_len,sub_len,out_len;
Py_ssize_t count = -1;
- PyObject *new;
+ PyObject *newstr;
WARN;
if (!PyArg_ParseTuple(args, "t#t#t#|n:replace",
@@ -1165,14 +1165,14 @@
}
if (out_len == -1) {
/* we're returning another reference to the input string */
- new = PyTuple_GetItem(args, 0);
- Py_XINCREF(new);
+ newstr = PyTuple_GetItem(args, 0);
+ Py_XINCREF(newstr);
}
else {
- new = PyString_FromStringAndSize(new_s, out_len);
+ newstr = PyString_FromStringAndSize(new_s, out_len);
PyMem_FREE(new_s);
}
- return new;
+ return newstr;
}