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):
108
108
Given a Traversable object, return that object as a
109
109
path on the local file system in a context manager.
110
110
"""
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
112
116
yield local
113
117
114
118
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ def files(self):
22
22
class ZipReader (abc .TraversableResources ):
23
23
def __init__ (self , loader , module ):
24
24
_ , _ , 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
27
27
28
28
def open_resource (self , resource ):
29
29
try :
@@ -38,4 +38,4 @@ def is_resource(self, path):
38
38
return target .is_file () and target .exists ()
39
39
40
40
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