Skip to content

Conversation

@devdanzin
Copy link
Member

@devdanzin devdanzin commented Jul 23, 2024

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 by os.stat() in updatecache() in linecache.py when trying to print a traceback with a too long filename.

Copy link
Member

@picnixz picnixz left a 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 calls os.stat).

You can pick what I wrote here: 405a921

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.


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

@devdanzin
Copy link
Member Author

Closing due to @picnixz's version being more complete and polished, thanks!

@devdanzin devdanzin closed this Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants