Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alexmojaki
Copy link
Owner

@alexmojaki alexmojaki commented Aug 27, 2022

Fixes:

This ensures that Source.for_filename always calls linecache.checkcache so that outdated entries are purged and the Source reflects the latest content of the file. It's more robust than #45 as it doesn't depend on sys.meta_path or even modules being reloaded.

Code elsewhere that pops entries from __source_cache is no longer needed, but is harmless and will keep things working with older versions of executing.

If linecache.checkcache removes an entry and linecache.getlines doesn't create a new one, then the original is restored. This means that code which directly inserts entries into linecache.cache to avoid the file system is still safe from linecache.checkcache aggressively removing entries for fake filenames.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant