mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
#17526: merge with 3.3.
This commit is contained in:
commit
0503de9c83
3 changed files with 10 additions and 1 deletions
|
@ -550,7 +550,7 @@ def findsource(object):
|
|||
|
||||
file = getfile(object)
|
||||
sourcefile = getsourcefile(object)
|
||||
if not sourcefile and file[0] + file[-1] != '<>':
|
||||
if not sourcefile and file[:1] + file[-1:] != '<>':
|
||||
raise OSError('source code not available')
|
||||
file = sourcefile if sourcefile else file
|
||||
|
||||
|
|
|
@ -416,6 +416,12 @@ class TestBuggyCases(GetSourceBase):
|
|||
finally:
|
||||
del linecache.cache[co.co_filename]
|
||||
|
||||
def test_findsource_without_filename(self):
|
||||
for fname in ['', '<string>']:
|
||||
co = compile('x=1', fname, "exec")
|
||||
self.assertRaises(IOError, inspect.findsource, co)
|
||||
self.assertRaises(IOError, inspect.getsource, co)
|
||||
|
||||
class TestNoEOL(GetSourceBase):
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.tempdir = TESTFN + '_dir'
|
||||
|
|
|
@ -297,6 +297,9 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #17526: fix an IndexError raised while passing code without filename to
|
||||
inspect.findsource(). Initial patch by Tyler Doyle.
|
||||
|
||||
- Issue #17540: Added style to formatter configuration by dict.
|
||||
|
||||
- Issue #16692: The ssl module now supports TLS 1.1 and TLS 1.2. Initial
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue