Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 24854:136b853622cc legacy-trunk
Minor cleanup of parsename() and parsestr(): the 'struct compiling *'
argument should be called 'c', like everywhere else. Renamed a
complex variable 'c' to 'z' and moved it inside the only scope where
it's used.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 16 Aug 2002 01:57:32 +0000 |
| parents | cf5928fab108 |
| children | bed5d5e536bc |
line wrap: on
line diff
--- a/Python/compile.c Thu Aug 15 22:14:24 2002 +0000 +++ b/Python/compile.c Fri Aug 16 01:57:32 2002 +0000 @@ -1133,13 +1133,12 @@ } static PyObject * -parsenumber(struct compiling *co, char *s) +parsenumber(struct compiling *c, char *s) { char *end; long x; double dx; #ifndef WITHOUT_COMPLEX - Py_complex c; int imflag; #endif @@ -1158,8 +1157,8 @@ "hex/oct constants > sys.maxint " "will return positive values " "in Python 2.4 and up", - co->c_filename, - co->c_lineno, + c->c_filename, + c->c_lineno, NULL, NULL) < 0) return NULL; @@ -1176,11 +1175,12 @@ /* XXX Huge floats may silently fail */ #ifndef WITHOUT_COMPLEX if (imflag) { - c.real = 0.; + Py_complex z; + z.real = 0.; PyFPE_START_PROTECT("atof", return 0) - c.imag = atof(s); - PyFPE_END_PROTECT(c) - return PyComplex_FromCComplex(c); + z.imag = atof(s); + PyFPE_END_PROTECT(z) + return PyComplex_FromCComplex(z); } else #endif @@ -1215,7 +1215,7 @@ } static PyObject * -parsestr(struct compiling *com, char *s) +parsestr(struct compiling *c, char *s) { PyObject *v; size_t len; @@ -1224,7 +1224,7 @@ char *end; int quote = *s; int rawmode = 0; - char* encoding = ((com == NULL) ? NULL : com->c_encoding); + char* encoding = ((c == NULL) ? NULL : c->c_encoding); int need_encoding; int unicode = 0; @@ -1245,7 +1245,7 @@ s++; len = strlen(s); if (len > INT_MAX) { - com_error(com, PyExc_OverflowError, + com_error(c, PyExc_OverflowError, "string to parse is too long"); return NULL; } @@ -1315,7 +1315,7 @@ v = PyUnicode_DecodeUnicodeEscape(buf, len, NULL); Py_XDECREF(u); if (v == NULL) - PyErr_SyntaxLocation(com->c_filename, com->c_lineno); + PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; } @@ -1345,7 +1345,7 @@ v = PyString_DecodeEscape(s, len, NULL, unicode, need_encoding ? encoding : NULL); if (v == NULL) - PyErr_SyntaxLocation(com->c_filename, com->c_lineno); + PyErr_SyntaxLocation(c->c_filename, c->c_lineno); return v; }
