Roundup Robot devnull@devnull added the comment:
New changeset 527c40add91d by Benjamin Peterson in branch '2.7':
allow fake filenames in findsource (closes #9284)
http://hg.python.org/cpython/rev/527c40add91d
New changeset 6cc4579dca02 by Benjamin Peterson in branch '3.2':
allow fake filenames
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
Would it still be possible to get this into 2.7.2? It's a 2.6-2.7 regression,
would be nice to fix, and it seems fairly low-impact.
--
nosy: +benjamin.peterson
___
Python tracker
Benjamin Peterson benja...@python.org added the comment:
- First line should be directly after the docstring
- One import per line
- Shouldn't this test be in test_inspect, since that's what you're changing?
--
___
Python tracker
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
I'm fine with moving the test; I put it in doctest because the inspect behavior
we're relying upon here seems somewhat doctest-specific, and the test itself is
a doctest. Do you want me to move it? I'll fix up the other things as well.
Benjamin Peterson benja...@python.org added the comment:
2011/6/9 Dirkjan Ochtman rep...@bugs.python.org:
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
I'm fine with moving the test; I put it in doctest because the inspect
behavior we're relying upon here seems somewhat
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
Here's a fresh patch.
--
Added file: http://bugs.python.org/file22297/issue9284.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9284
Changes by Dirkjan Ochtman dirk...@ochtman.nl:
Removed file: http://bugs.python.org/file22270/issue9284.diff
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9284
___
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
Here's an attempted patch against 2.7. It seemed nice to put the test in
test_doctest, but maybe it belongs in inspect...
--
keywords: +needs review, patch
Added file: http://bugs.python.org/file22270/issue9284.diff
New submission from Dirkjan Ochtman dirk...@ochtman.nl:
The fix for issue4050 broke some of my doctests. Minimal test:
import doctest, inspect
def test():
'''
def x(): pass
inspect.getsource(x)
'def x(): pass\\n'
'''
doctest.run_docstring_examples(test, globals())
This
Changes by Antoine Pitrou pit...@free.fr:
--
priority: normal - critical
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9284
___
___
Antoine Pitrou pit...@free.fr added the comment:
After chatting with Dirkjan, I misunderstood the impact of the patch. It only
occurs when inspect.getsource() is called from a doctest, which isn't a very
common situation.
--
priority: critical - normal
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
Here's a test case that doesn't require doctest trickery:
import inspect, linecache
fn, source = 'test', 'def x(): pass\n'
getlines = linecache.getlines
def monkey(filename, module_globals=None):
if filename == fn:
return
Dirkjan Ochtman dirk...@ochtman.nl added the comment:
Because doctest also monkeypatches linecache, and without monkeypatching
linecache this also fails in 2.6.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9284
R. David Murray rdmur...@bitdance.com added the comment:
Oh, right, I remember that now. Thanks.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9284
___
14 matches
Mail list logo