[issue27578] inspect.findsource raises exception with empty __init__.py

2020-11-13 Thread kernc
kernc added the comment: The proposed patch doesn't break any interfaces. `inspect.getsource/.getsourcelines()` still raise `OSError` if the source is unretrievable. `linecache.getlines()` is undocumented, but the change retains perfect compatibility with *docstrings* of both

[issue27578] inspect.findsource raises exception with empty __init__.py

2020-07-06 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree that getsource raising is a bug. I would more at the behavior and doc for getlines before I decided about that. -- nosy: +terry.reedy versions: -Python 2.7, Python 3.5, Python 3.6, Python 3.9 ___ Python

[issue27578] inspect.findsource raises exception with empty __init__.py

2020-06-11 Thread kernc
Change by kernc : -- keywords: +patch pull_requests: +20006 stage: -> patch review pull_request: https://github.com/python/cpython/pull/20809 ___ Python tracker ___

[issue27578] inspect.findsource raises exception with empty __init__.py

2020-06-11 Thread kernc
Change by kernc : -- nosy: +kernc versions: +Python 3.10, Python 3.9 ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-21 Thread R. David Murray
R. David Murray added the comment: I think someone should propose a patch with tests and we'll evaluate it. We prefer to retain backward compatibility even on undocumented interfaces, if possible, but yes they are more open to change (though only in a feature release, in general).

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-21 Thread Antti Haapala
Antti Haapala added the comment: It must be noted that `getlines` itself is not documented, and thus there is no backwards-compatibility to preserve really. `getline` returns '' for *any* erroneous line, so it wouldn't affect it. -- ___ Python

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-21 Thread Antti Haapala
Antti Haapala added the comment: Or perhaps getlines should return [''] for empty regular files? -- nosy: +ztane ___ Python tracker ___

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-20 Thread R. David Murray
R. David Murray added the comment: I agree that this is inconsistent. It might be quite tricky to fix, though, unless we special case file.endswith('__init__.py'), which feels like a hack. But maybe it is appropriate. -- nosy: +r.david.murray versions: +Python 3.6

[issue27578] inspect.findsource raises exception with empty __init__.py

2016-07-20 Thread Alexander Todorov
New submission from Alexander Todorov: $ python2 Python 2.7.5 (default, Oct 11 2015, 17:47:16) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import inspect >>> from pykickstart import handlers >>>