jaraco / zipp

MIT License
61 stars 53 forks source link

create lazy loading lookup class to support pickling #82

Closed parkerhancock closed 2 years ago

parkerhancock commented 2 years ago

This addresses #81 by creating a lazy-loading FastLookup object if the root is a string or a pathlib.Path object. By doing this, when either a string or a pathlib.Path is used as a root for a zipp.Path, the path object does not hold an open file handle, and thus can be pickled.

zipp.Path objects that are pickleable can then be passed around multiprocessing libraries without fear of running into the dreaded TypeError: cannot serialize '_io.BufferedReader' object error.