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

Reply via email to