Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 12278:647bf71912f0 legacy-trunk
Vladimir Marangozov: This fixes the line number in the string
representation of code objects when optimization is on (python -O). It
was always reported as -1 instead of the real lineno.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Fri, 07 Apr 2000 01:21:36 +0000 |
| parents | 96ea1a800b23 |
| children | 525b2358721e |
line wrap: on
line diff
--- a/Python/compile.c Thu Apr 06 20:09:17 2000 +0000 +++ b/Python/compile.c Fri Apr 07 01:21:36 2000 +0000 @@ -121,13 +121,11 @@ { char buf[500]; int lineno = -1; - unsigned char *p; char *filename = "???"; char *name = "???"; - _PyCode_GETCODEPTR(co, &p); - if (*p == SET_LINENO) - lineno = (p[1] & 0xff) | ((p[2] & 0xff) << 8); + if (co->co_firstlineno != 0) + lineno = co->co_firstlineno; if (co->co_filename && PyString_Check(co->co_filename)) filename = PyString_AsString(co->co_filename); if (co->co_name && PyString_Check(co->co_name))
