File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,11 @@ def as_file(path):
108108 Given a Traversable object, return that object as a
109109 path on the local file system in a context manager.
110110 """
111- with _tempfile (path .read_bytes , suffix = path .name ) as local :
111+ reader = path .read_bytes
112+ with _tempfile (reader , suffix = path .name ) as local :
113+ # release the handle to the path and reader
114+ del reader
115+ del path
112116 yield local
113117
114118
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ def files(self):
2222class ZipReader (abc .TraversableResources ):
2323 def __init__ (self , loader , module ):
2424 _ , _ , name = module .rpartition ('.' )
25- prefix = loader .prefix .replace ('\\ ' , '/' ) + name + '/'
26- self .path = ZipPath ( loader .archive , prefix )
25+ self . prefix = loader .prefix .replace ('\\ ' , '/' ) + name + '/'
26+ self .archive = loader .archive
2727
2828 def open_resource (self , resource ):
2929 try :
@@ -38,4 +38,4 @@ def is_resource(self, path):
3838 return target .is_file () and target .exists ()
3939
4040 def files (self ):
41- return self .path
41+ return ZipPath ( self .archive , self . prefix )
You can’t perform that action at this time.
0 commit comments