Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
gh-122170: Fix interpreter exiting due to ValueError fromos.stat
for too long filename on Windows#122175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
… in linecache.updatecache().
…che.updatecache(), add test.
There was a problem hiding this comment.
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 callsos.stat
).
You can pick what I wrote here:405a921
@@ -98,7 +98,7 @@ def updatecache(filename, module_globals=None): | |||
fullname = filename | |||
try: | |||
stat = os.stat(fullname) | |||
except OSError: | |||
except(OSError, ValueError): |
There was a problem hiding this comment.
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.
@@ -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), []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Also checkcheckcache
(which I forgot on my branch).
Closing due to@picnixz's version being more complete and polished, thanks! |
Uh oh!
There was an error while loading.Please reload this page.
This PR fixes the interpreter exiting on Windows in 3.13.0b4 and main due to
ValueError: stat: path too long for Windows
being raised byos.stat()
inupdatecache()
in linecache.py when trying to print a traceback with a too long filename.