Skip to content

Commit 7024189

Browse files
committed
Fix ZipPathGround.readtext
1 parent 0601add commit 7024189

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Lib/test/test_pathlib/support/zip_path.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,13 @@ def create_hierarchy(self, p):
231231
self.create_link(p.joinpath('brokenLinkLoop'), 'brokenLinkLoop')
232232

233233
def readtext(self, p):
234-
return p.zip_file.read(str(p)).decode()
234+
with p.zip_file.open(str(p), 'r') as f:
235+
f = io.TextIOWrapper(f)
236+
return f.read()
235237

236238
def readbytes(self, p):
237-
return p.zip_file.read(str(p))
239+
with p.zip_file.open(str(p), 'r') as f:
240+
return f.read()
238241

239242
readlink = readtext
240243

0 commit comments

Comments
 (0)