diff options
Diffstat (limited to 'Lib/zipfile/_path.py')
-rw-r--r-- | Lib/zipfile/_path.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Lib/zipfile/_path.py b/Lib/zipfile/_path.py index 67ef07a..aea17b6 100644 --- a/Lib/zipfile/_path.py +++ b/Lib/zipfile/_path.py @@ -62,7 +62,25 @@ def _difference(minuend, subtrahend): return itertools.filterfalse(set(subtrahend).__contains__, minuend) -class CompleteDirs(zipfile.ZipFile): +class InitializedState: + """ + Mix-in to save the initialization state for pickling. + """ + + def __init__(self, *args, **kwargs): + self.__args = args + self.__kwargs = kwargs + super().__init__(*args, **kwargs) + + def __getstate__(self): + return self.__args, self.__kwargs + + def __setstate__(self, state): + args, kwargs = state + super().__init__(*args, **kwargs) + + +class CompleteDirs(InitializedState, zipfile.ZipFile): """ A ZipFile subclass that ensures that implied directories are always included in the namelist. |