diff options
author | Guido van Rossum <guido@python.org> | 2000-04-07 01:21:36 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-04-07 01:21:36 (GMT) |
commit | a396a883aff2b218680f04a7f17db91bc940e94e (patch) | |
tree | 0ad5e92847853028ca4f357b2c3287bc996cf70c /Python | |
parent | fa9ef1864fb17b1d42456b15811d66029a2fa91e (diff) | |
download | cpython-a396a883aff2b218680f04a7f17db91bc940e94e.zip cpython-a396a883aff2b218680f04a7f17db91bc940e94e.tar.gz cpython-a396a883aff2b218680f04a7f17db91bc940e94e.tar.bz2 |
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.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Python/compile.c b/Python/compile.c index 5aaf15e..d676b56 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -121,13 +121,11 @@ code_repr(co) { 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)) |