[issue8782] inspect.getsource returns invalid source for non-newline-ending module

2010-05-22 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

2010/5/22 holger krekel rep...@bugs.python.org:

 holger krekel holger.kre...@gmail.com added the comment:

 Great. Also to be backported to 2.x?

That is 2.x.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8782] inspect.getsource returns invalid source for non-newline-ending module

2010-05-21 Thread holger krekel

New submission from holger krekel holger.kre...@gmail.com:

Executing the attached inspect_failure.py under python2.6 or python3.1 
results in an assertion error: Python fails to obtain the source code of a 
function that is defined at the end of a module whose last line does not 
contain a line ending character. 

After brief analysis i think there are two approaches to fixing it: normalizing 
newlines in inspect.findsource (see attached inspect.patch file against r312) 
or performing normalization in linecache.updatecache which does it already for 
source code obtained from PEP302 loaders. Or any other ideas?

--
files: inspect.patch
keywords: patch
messages: 106245
nosy: hpk
priority: normal
severity: normal
status: open
title: inspect.getsource returns invalid source for non-newline-ending module
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3
Added file: http://bugs.python.org/file17431/inspect.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue8782] inspect.getsource returns invalid source for non-newline-ending module

2010-05-21 Thread Benjamin Peterson

Benjamin Peterson benja...@python.org added the comment:

Fixed in r81432 by making linecache smarter.

--
nosy: +benjamin.peterson
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue8782
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com