2006-02-06 09:15:06 PST
For raw_input() to work, I modified
builtin_raw_input() in bltinmodule.c with:
/*------------ bltinmodule_mod.c ------------*/
char* RawInputChar(char* prompt);
static PyObject *
builtin_raw_input(PyObject *self, PyObject *args)
{
PyObject *v = NULL;
char *s;
int len;
if (PyArg_UnpackTuple(args, "[raw_]input", 0, 1, &v))
{
PyObject *po;
char *prompt;
if (v != NULL) {
po = PyObject_Str(v);
if (po == NULL)
return NULL;
prompt = PyString_AsString(po);
if (prompt == NULL)
return NULL;
}
else {
po = NULL;
prompt = "";
}
s = RawInputChar(prompt);
Py_XDECREF(po);
len = strlen(s);
return PyString_FromStringAndSize(s, len);
}
return NULL;
}