Use a dict to de-duplicate filenames, and thus reduce the size of the to_dict() #38
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is the patch I had in mind for #37. I've left the doctest's failing like this so you can see what the functional change is (and also because I'm not yet familiar enough with doctest :-)):
The basic change is that the co_filename, which often contains non-trivial filenames and duplicates too, stores an integer instead, and an extra "zip" dict at the top level provides the de-dupe service.
One other thing: for reasons I don't quite understand, on my dev system, though not in these tests, the
f_globals
dict also has a__file__
which I also took care of via "zip"...I don't understand why that field is not present here. It also stores the filename, and is a major cause of duplicates for my setup. (Yes, I'm baffled by this).