]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Use strtoul() for oct/hex constants.
authorGuido van Rossum <guido@python.org>
Sun, 19 Jan 1992 16:33:51 +0000 (16:33 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 19 Jan 1992 16:33:51 +0000 (16:33 +0000)
Accept * as well as + in varargs arg list.

Python/compile.c

index 4cd1c94efa4d9248d60abe5e1cc543a040040c48..532e498fce13bc320e888543e2c539c1c6dfdc93 100644 (file)
@@ -409,6 +409,7 @@ parsenumber(s)
        char *s;
 {
        extern long strtol();
+       extern unsigned long strtoul();
        extern double strtod();
        char *end;
        long x;
@@ -419,7 +420,10 @@ parsenumber(s)
                extern object *long_scan();
                return long_scan(s, 0);
        }
-       x = strtol(s, &end, 0);
+       if (s[0] == '0')
+               x = (long) strtoul(s, &end, 0);
+       else
+               x = strtol(s, &end, 0);
        if (*end == '\0') {
                if (errno != 0) {
                        err_setstr(OverflowError,
@@ -485,7 +489,9 @@ parsestr(s)
                case 'n': *p++ = '\n'; break;
                case 'r': *p++ = '\r'; break;
                case 'v': *p++ = '\013'; break; /* VT */
+#if 0
                case 'E': *p++ = '\033'; break; /* ESC, not C */
+#endif
                case 'a': *p++ = '\007'; break; /* BEL, not classic C */
                case '0': case '1': case '2': case '3':
                case '4': case '5': case '6': case '7':
@@ -1962,11 +1968,13 @@ com_arglist(c, n)
 {
        int i, nargs, op;
        REQ(n, varargslist);
-       /* varargslist: (fpdef ',')* '+' NAME | fpdef (',' fpdef)* [','] */
+       /* varargslist:
+          (fpdef ',')* ('+'|'*') NAME | fpdef (',' fpdef)* [','] */
        op = UNPACK_ARG;
        nargs = (NCH(n) + 1) / 2;
        for (i = 0; i < NCH(n); i += 2) {
-               if (TYPE(CHILD(n, i)) == PLUS) {
+               int t = TYPE(CHILD(n, i));
+               if (t == PLUS || t == STAR) {
                        op = UNPACK_VARARG;
                        nargs = i/2;
                        break;