diff options
author | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 06:04:34 (GMT) |
---|---|---|
committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-03-17 06:04:34 (GMT) |
commit | 9e2b9665ae9f94a07da54156c48e2cd411a23746 (patch) | |
tree | d3f394989607f8aa9c14563291e319fe24ef2a17 /Python/bltinmodule.c | |
parent | cd65e3fc7d3280defdb14d75ffe71e665ed85989 (diff) | |
download | cpython-9e2b9665ae9f94a07da54156c48e2cd411a23746.zip cpython-9e2b9665ae9f94a07da54156c48e2cd411a23746.tar.gz cpython-9e2b9665ae9f94a07da54156c48e2cd411a23746.tar.bz2 |
Whoops, input *and* raw_input are slated for removal, and now both are gone.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r-- | Python/bltinmodule.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index a5dc0e3..4c168eb 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1074,91 +1074,6 @@ Return the hexadecimal representation of an integer or long integer."); static PyObject * -builtin_input(PyObject *self, PyObject *args) -{ - PyObject *v = NULL; - PyObject *fin = PySys_GetObject("stdin"); - PyObject *fout = PySys_GetObject("stdout"); - - if (!PyArg_UnpackTuple(args, "input", 0, 1, &v)) - return NULL; - - if (fin == NULL) { - PyErr_SetString(PyExc_RuntimeError, "input: lost sys.stdin"); - return NULL; - } - if (fout == NULL) { - PyErr_SetString(PyExc_RuntimeError, "input: lost sys.stdout"); - return NULL; - } - if (PyFile_SoftSpace(fout, 0)) { - if (PyFile_WriteString(" ", fout) != 0) - return NULL; - } - if (PyFile_Check(fin) && PyFile_Check(fout) - && isatty(fileno(PyFile_AsFile(fin))) - && isatty(fileno(PyFile_AsFile(fout)))) { - PyObject *po; - char *prompt; - char *s; - PyObject *result; - 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 = PyOS_Readline(PyFile_AsFile(fin), PyFile_AsFile(fout), - prompt); - Py_XDECREF(po); - if (s == NULL) { - if (!PyErr_Occurred()) - PyErr_SetNone(PyExc_KeyboardInterrupt); - return NULL; - } - if (*s == '\0') { - PyErr_SetNone(PyExc_EOFError); - result = NULL; - } - else { /* strip trailing '\n' */ - size_t len = strlen(s); - if (len > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "[raw_]input: input too long"); - result = NULL; - } - else { - result = PyString_FromStringAndSize(s, - (int)(len-1)); - } - } - PyMem_FREE(s); - return result; - } - if (v != NULL) { - if (PyFile_WriteObject(v, fout, Py_PRINT_RAW) != 0) - return NULL; - } - return PyFile_GetLine(fin, -1); -} - -PyDoc_STRVAR(input_doc, -"input([prompt]) -> string\n\ -\n\ -Read a string from standard input. The trailing newline is stripped.\n\ -If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.\n\ -On Unix, GNU readline is used if enabled. The prompt string, if given,\n\ -is printed without a trailing newline before reading."); - - - -static PyObject * builtin_intern(PyObject *self, PyObject *args) { PyObject *s; @@ -2193,7 +2108,6 @@ static PyMethodDef builtin_methods[] = { {"hash", builtin_hash, METH_O, hash_doc}, {"hex", builtin_hex, METH_O, hex_doc}, {"id", builtin_id, METH_O, id_doc}, - {"input", builtin_input, METH_VARARGS, input_doc}, {"intern", builtin_intern, METH_VARARGS, intern_doc}, {"isinstance", builtin_isinstance, METH_VARARGS, isinstance_doc}, {"issubclass", builtin_issubclass, METH_VARARGS, issubclass_doc}, |