◐ Shell
clean mode source ↗

gh-122170: Fix interpreter exiting due to ValueError from `os.stat` for too long filename on Windows by devdanzin · Pull Request #122175 · python/cpython

picnixz

Choose a reason for hiding this comment

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

checkcache is may also be subject to the same issue (it calls os.stat).

You can pick what I wrote here: 405a921

try:
stat = os.stat(fullname)
except OSError:
except (OSError, ValueError):

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.


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

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).