]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use fileobject's filegetline() to implement unlimited raw_input().
authorGuido van Rossum <guido@python.org>
Thu, 4 Apr 1991 15:20:41 +0000 (15:20 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 4 Apr 1991 15:20:41 +0000 (15:20 +0000)
Python/bltinmodule.c

index 1d7d83883ff35a18f3dbe49d75486c9b96028c3e..08f34bc5e655561150182e43e3b31f8bdaec1c2c 100644 (file)
@@ -436,29 +436,11 @@ builtin_raw_input(self, v)
        object *self;
        object *v;
 {
-       FILE *in = sysgetfile("stdin", stdin);
        FILE *out = sysgetfile("stdout", stdout);
-       char *p;
-       int err;
-       int n = 1000;
        flushline();
        if (v != NULL)
                printobject(v, out, PRINT_RAW);
-       v = newsizedstringobject((char *)NULL, n);
-       if (v != NULL) {
-               if ((err = fgets_intr(getstringvalue(v), n+1, in)) != E_OK) {
-                       err_input(err);
-                       DECREF(v);
-                       return NULL;
-               }
-               else {
-                       n = strlen(getstringvalue(v));
-                       if (n > 0 && getstringvalue(v)[n-1] == '\n')
-                               n--;
-                       resizestring(&v, n);
-               }
-       }
-       return v;
+       return filegetline(sysget("stdin"), -1);
 }
 
 static object *