Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/linecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def updatecache(filename, module_globals=None):
fullname = filename
try:
stat = os.stat(fullname)
except OSError:
except (OSError, ValueError):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one should not be suppressed on Unix platforms.

basename = filename

# Realise a lazy loader based lookup if there is one
Expand Down Expand Up @@ -135,7 +135,7 @@ def updatecache(filename, module_globals=None):
try:
stat = os.stat(fullname)
break
except OSError:
except (OSError, ValueError):
pass
else:
return []
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_linecache.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ def test_loader(self):
self.assertEqual(linecache.getlines(filename, module_globals),
['source for x.y.z\n'])

@unittest.skipUnless(support.MS_WINDOWS, "Test only relevant in Windows.")
def test_filename_too_long(self):
self.assertEqual(linecache.updatecache("s" * 999999), [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also check checkcache (which I forgot on my branch).



class LineCacheInvalidationTests(unittest.TestCase):
def setUp(self):
Expand Down
Loading