]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
added missing case to get_docstring
authorGuido van Rossum <guido@python.org>
Thu, 26 Jan 1995 00:40:09 +0000 (00:40 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 26 Jan 1995 00:40:09 +0000 (00:40 +0000)
Python/compile.c

index 93d5b6d22c4df505b1a1c5ab053c031906eabfa6..45bed3933e3370b03025e333aa3298fc0cb3dcad 100644 (file)
@@ -483,7 +483,6 @@ com_addopname(c, op, n)
        int op;
        node *n;
 {
-       object *v;
        char *name;
        char buffer[1000];
        /* XXX it is possible to write this code without the 1000
@@ -1868,13 +1867,14 @@ static object *
 get_docstring(n)
        node *n;
 {
+       int i;
+
        switch (TYPE(n)) {
 
        case suite:
                if (NCH(n) == 1)
                        return get_docstring(CHILD(n, 0));
                else {
-                       int i;
                        for (i = 0; i < NCH(n); i++) {
                                node *ch = CHILD(n, i);
                                if (TYPE(ch) == stmt)
@@ -1883,6 +1883,14 @@ get_docstring(n)
                }
                break;
 
+       case file_input:
+               for (i = 0; i < NCH(n); i++) {
+                       node *ch = CHILD(n, i);
+                       if (TYPE(ch) == stmt)
+                               return get_docstring(ch);
+               }
+               break;
+
        case stmt:
        case simple_stmt:
        case small_stmt: