Issue1754483
Created on 2007-07-15 22:40 by kevingoodsell, last changed 2009-05-05 08:22 by georg.brandl.
| File name |
Uploaded |
Description |
Edit |
Remove |
|
linecache.py.patch
|
kevingoodsell,
2007-07-16 22:58
|
Patch for linecache handling of packages (Updated - comment typo fixed) |
|
|
|
linecache.py_2008_07_04.patch
|
kevingoodsell,
2008-07-05 05:58
|
New patch |
|
|
|
test.py
|
kevingoodsell,
2008-07-05 06:00
|
Test script for linecache |
|
|
|
msg52881 - (view) |
Author: Kevin Goodsell (kevingoodsell) |
Date: 2007-07-15 22:40 |
|
The linecache module does not handle packages at all (Guido mentions here that he wrote it before Python had packages: http://mail.python.org/pipermail/python-dev/2005-September/056870.html).
This seems to cause problems with pdb and pydoc, as illustrated by this example:
$ mkdir pydoc_test
$ cd pydoc_test
$ echo "#" > __init__.py
$ pydoc logging
This gives a traceback due to an out of range index, resulting essentially from ./__init__.py being confused with logging/__init__.py. A line number from the latter is used as an index into a list of the lines from the former.
Patch attached, and a bit more explanation can be seen here:
https://bugs.launchpad.net/ubuntu/+source/python-defaults/+bug/70902
|
|
msg52882 - (view) |
Author: Kevin Goodsell (kevingoodsell) |
Date: 2007-07-16 22:58 |
|
New patch upload, typo fix.
File Added: linecache.py.patch
|
|
msg69032 - (view) |
Author: Hans Ulrich Niedermann (ndim) |
Date: 2008-07-01 00:25 |
|
The patch does not fix the underlying problem which is not limited to
files named '__init__.py'.
|
|
msg69035 - (view) |
Author: Hans Ulrich Niedermann (ndim) |
Date: 2008-07-01 00:28 |
|
The following issues appear to be the same bug to me:
http://bugs.python.org/issue1068477
http://bugs.python.org/issue1309567
http://bugs.python.org/issue1754483
and are, as of 2008-06-30, unfixed in both rel25-maint and trunk.
|
|
msg69272 - (view) |
Author: Kevin Goodsell (kevingoodsell) |
Date: 2008-07-05 05:58 |
|
Hans is right, that patch isn't very good. Here's a second pass. This
one avoids joining the file basename to sys.path components, which I'd
say is wrong since it strips (presumably relevant) leading path components.
A second part of this skips out early on absolute file names, which
prevents joining them with sys.path components also. As far as I can
tell this would cause no harm, but it's not useful either.
|
|
msg69273 - (view) |
Author: Kevin Goodsell (kevingoodsell) |
Date: 2008-07-05 06:00 |
|
Here's a small test script.
|
|
msg69279 - (view) |
Author: Hans Ulrich Niedermann (ndim) |
Date: 2008-07-05 12:37 |
|
Even with that patch, I'm still getting backtraces similar to this:
Traceback (most recent call last):
File "/home/user/foo/src/foo", line 83, in <module>
foomain(sys.argv)
File "/home/uli/foo/src/foo", line 79, in foomain
foolib.main.cmdmain(sys.argv)
File "./foolib/main.py", line 250, in cmdmain
File "./foolib/main.py", line 199, in main
File "./foolib/main.py", line 180, in __init__
File "./foolib/main.py", line 115, in __get__
AttributeError: property--48216a94
Looks like I should write a dozen test cases I can think of on my own. :)
|
|
msg86548 - (view) |
Author: Daniel Diniz (ajaksu2) |
Date: 2009-04-25 20:32 |
|
Test script works with patch from issue 1309567. Hans, do you have more
test cases?
|
|
msg87222 - (view) |
Author: Georg Brandl (georg.brandl) |
Date: 2009-05-05 08:22 |
|
Setting #1309567 as superseder.
|
|
| Date |
User |
Action |
Args |
| 2009-05-05 08:22:17 | georg.brandl | set | status: open -> closed superseder: linecache module returns wrong results messages:
+ msg87222
dependencies:
- linecache module returns wrong results resolution: duplicate |
| 2009-04-25 20:32:06 | ajaksu2 | set | versions:
+ Python 2.6, Python 3.0 nosy:
+ ajaksu2
messages:
+ msg86548
dependencies:
+ linecache module returns wrong results type: behavior |
| 2008-07-05 12:37:21 | ndim | set | messages:
+ msg69279 |
| 2008-07-05 09:49:01 | georg.brandl | set | assignee: georg.brandl nosy:
+ georg.brandl |
| 2008-07-05 06:00:55 | kevingoodsell | set | files:
+ test.py messages:
+ msg69273 |
| 2008-07-05 05:58:46 | kevingoodsell | set | files:
+ linecache.py_2008_07_04.patch messages:
+ msg69272 |
| 2008-07-01 00:28:27 | ndim | set | messages:
+ msg69035 |
| 2008-07-01 00:25:59 | ndim | set | nosy:
+ ndim messages:
+ msg69032 |
| 2007-07-15 22:40:12 | kevingoodsell | create | |
|