[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-11 Thread Roundup Robot
Roundup Robot 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 in findsour

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Dirkjan Ochtman
Changes by Dirkjan Ochtman : Removed file: http://bugs.python.org/file22270/issue9284.diff ___ Python tracker ___ ___ Python-bugs-list mailing

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Dirkjan Ochtman
Dirkjan Ochtman added the comment: Here's a fresh patch. -- Added file: http://bugs.python.org/file22297/issue9284.diff ___ Python tracker ___ ___

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2011/6/9 Dirkjan Ochtman : > > Dirkjan Ochtman 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

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Dirkjan Ochtman
Dirkjan Ochtman 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. -- __

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Benjamin Peterson
Benjamin Peterson 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

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-09 Thread Dirkjan Ochtman
Dirkjan Ochtman 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

[issue9284] inspect.findsource() cannot find source for doctest code

2011-06-07 Thread Dirkjan Ochtman
Dirkjan Ochtman 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 __

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread R. David Murray
R. David Murray added the comment: Oh, right, I remember that now. Thanks. -- ___ Python tracker ___ ___ Python-bugs-list mailing lis

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread Dirkjan Ochtman
Dirkjan Ochtman added the comment: Because doctest also monkeypatches linecache, and without monkeypatching linecache this also fails in 2.6. -- ___ Python tracker ___ _

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread R. David Murray
R. David Murray added the comment: I don't understand why monkey patching linecache produces a valid test case. Can you explain? Since I believe the same code/bugfix is in 3.x, I'm adding those versions. -- stage: needs patch -> unit test needed versions: +Python 3.1, Python 3.2 ___

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread Dirkjan Ochtman
Dirkjan Ochtman added the comment: Here's a test case that doesn't require doctest trickery: import inspect, linecache fn, source = '', 'def x(): pass\n' getlines = linecache.getlines def monkey(filename, module_globals=None): if filename == fn: return source.splitlines(True)

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread Antoine Pitrou
Antoine Pitrou 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 ___ Pytho

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- priority: normal -> critical ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue9284] inspect.findsource() cannot find source for doctest code

2010-07-17 Thread Dirkjan Ochtman
New submission from Dirkjan Ochtman : 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 works in 2.6, b