[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-29 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the report and the patch! -- assignee: - ezio.melotti nosy: +ezio.melotti resolution: - fixed stage: needs patch - committed/rejected status: open - closed versions: -Python 3.2 ___ Python tracker

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset bc73223e4c10 by Ezio Melotti in branch '2.7': #17526: fix an IndexError raised while passing code without filename to inspect.findsource(). Initial patch by Tyler Doyle. http://hg.python.org/cpython/rev/bc73223e4c10 New changeset 39e103c1577e by

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-27 Thread Tyler Doyle
Changes by Tyler Doyle kingt...@gmail.com: Removed file: http://bugs.python.org/file29576/inspect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17526 ___

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-27 Thread Tyler Doyle
Changes by Tyler Doyle kingt...@gmail.com: Removed file: http://bugs.python.org/file29577/test_inspect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17526 ___

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-27 Thread Tyler Doyle
Changes by Tyler Doyle kingt...@gmail.com: Added file: http://bugs.python.org/file29591/17526_getsource.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17526 ___

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-25 Thread Tyler Doyle
Tyler Doyle added the comment: It looks like file is getting set to '' and then indexed on line 553 below, hitting the IndexError before we ever get to IOError. --550--- file = getfile(object) -- file = '' sourcefile = getsourcefile(object) if not sourcefile

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-25 Thread Nils Bruin
Nils Bruin added the comment: The most straightforward change I can think of is to change the line if not sourcefile and file[0] + file[-1] != '': to if not sourcefile and (not file or file[0] + file[-1] != ''): That solves the problem in the cases I have observed. --

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-25 Thread Tyler Doyle
Changes by Tyler Doyle kingt...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file29576/inspect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17526 ___

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-25 Thread Tyler Doyle
Tyler Doyle added the comment: Patch and test to accompany. -- Added file: http://bugs.python.org/file29577/test_inspect.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17526 ___

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-24 Thread R. David Murray
R. David Murray added the comment: It is very likely the code is the same in 3.3 and 3.4, so I'm adding those versions without testing :) -- keywords: +easy nosy: +r.david.murray stage: - needs patch versions: +Python 3.3, Python 3.4 ___ Python

[issue17526] inspect.findsource raises undocumented error for code objects with empty filename

2013-03-22 Thread Nils Bruin
New submission from Nils Bruin: It would seem reasonable that an empty filename would be a legitimate way of indicating that a code object does not have a corresponding source file. However, if one does that then inspect.findsource raises an unexpected IndexError rather than the documented