diff options
author | Guido van Rossum <guido@python.org> | 1992-01-19 16:33:51 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-01-19 16:33:51 (GMT) |
commit | acbefefe21c86e918d7efff88e75cf69128f2115 (patch) | |
tree | 6ce906ccc8726307b45202f481a8473a5c8facf1 /Python/compile.c | |
parent | b674c3bba50b1f5ea212dd85366f871872ad0be4 (diff) | |
download | cpython-acbefefe21c86e918d7efff88e75cf69128f2115.zip cpython-acbefefe21c86e918d7efff88e75cf69128f2115.tar.gz cpython-acbefefe21c86e918d7efff88e75cf69128f2115.tar.bz2 |
Use strtoul() for oct/hex constants.
Accept * as well as + in varargs arg list.
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c index 4cd1c94..532e498 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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; |