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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2010-07-17 Thread Dirkjan Ochtman
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

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

2010-07-17 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- priority: normal - critical ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9284 ___ ___

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

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

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

2010-07-17 Thread Dirkjan Ochtman
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

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

2010-07-17 Thread Dirkjan Ochtman
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

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

2010-07-17 Thread R. David Murray
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 ___