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/Parser/pgen.c b/Parser/pgen.c
index e643d33..dfe7cac 100644
--- a/Parser/pgen.c
+++ b/Parser/pgen.c
@@ -49,7 +49,8 @@
{
nfastate *st;
- PyMem_RESIZE(nf->nf_state, nfastate, nf->nf_nstates + 1);
+ nf->nf_state = (nfastate *)PyObject_REALLOC(nf->nf_state,
+ sizeof(nfastate) * (nf->nf_nstates + 1));
if (nf->nf_state == NULL)
Py_FatalError("out of mem");
st = &nf->nf_state[nf->nf_nstates++];
@@ -65,7 +66,8 @@
nfaarc *ar;
st = &nf->nf_state[from];
- PyMem_RESIZE(st->st_arc, nfaarc, st->st_narcs + 1);
+ st->st_arc = (nfaarc *)PyObject_REALLOC(st->st_arc,
+ sizeof(nfaarc) * (st->st_narcs + 1));
if (st->st_arc == NULL)
Py_FatalError("out of mem");
ar = &st->st_arc[st->st_narcs++];
@@ -79,7 +81,7 @@
nfa *nf;
static int type = NT_OFFSET; /* All types will be disjunct */
- nf = PyMem_NEW(nfa, 1);
+ nf = (nfa *)PyObject_MALLOC(sizeof(nfa));
if (nf == NULL)
Py_FatalError("no mem for new nfa");
nf->nf_type = type++;
@@ -104,7 +106,7 @@
{
nfagrammar *gr;
- gr = PyMem_NEW(nfagrammar, 1);
+ gr = (nfagrammar *)PyObject_MALLOC(sizeof(nfagrammar));
if (gr == NULL)
Py_FatalError("no mem for new nfa grammar");
gr->gr_nnfas = 0;
@@ -121,7 +123,8 @@
nfa *nf;
nf = newnfa(name);
- PyMem_RESIZE(gr->gr_nfa, nfa *, gr->gr_nnfas + 1);
+ gr->gr_nfa = (nfa **)PyObject_REALLOC(gr->gr_nfa,
+ sizeof(nfa) * (gr->gr_nnfas + 1));
if (gr->gr_nfa == NULL)
Py_FatalError("out of mem");
gr->gr_nfa[gr->gr_nnfas++] = nf;
@@ -361,7 +364,7 @@
typedef struct _ss_state {
bitset ss_ss;
int ss_narcs;
- ss_arc *ss_arc;
+ struct _ss_arc *ss_arc;
int ss_deleted;
int ss_finish;
int ss_rename;
@@ -392,7 +395,7 @@
ss = newbitset(nbits);
addclosure(ss, nf, nf->nf_start);
- xx_state = PyMem_NEW(ss_state, 1);
+ xx_state = (ss_state *)PyObject_MALLOC(sizeof(ss_state));
if (xx_state == NULL)
Py_FatalError("no mem for xx_state in makedfa");
xx_nstates = 1;
@@ -411,6 +414,7 @@
/* For each unmarked state... */
for (istate = 0; istate < xx_nstates; ++istate) {
+ size_t size;
yy = &xx_state[istate];
ss = yy->ss_ss;
/* For all its states... */
@@ -430,8 +434,9 @@
goto found;
}
/* Add new arc for this state */
- PyMem_RESIZE(yy->ss_arc, ss_arc,
- yy->ss_narcs + 1);
+ size = sizeof(ss_arc) * (yy->ss_narcs + 1);
+ yy->ss_arc = (ss_arc *)PyObject_REALLOC(
+ yy->ss_arc, size);
if (yy->ss_arc == NULL)
Py_FatalError("out of mem");
zz = &yy->ss_arc[yy->ss_narcs++];
@@ -453,7 +458,9 @@
goto done;
}
}
- PyMem_RESIZE(xx_state, ss_state, xx_nstates + 1);
+ size = sizeof(ss_state) * (xx_nstates + 1);
+ xx_state = (ss_state *)PyObject_REALLOC(xx_state,
+ size);
if (xx_state == NULL)
Py_FatalError("out of mem");
zz->sa_arrow = xx_nstates;