从外观上看,至少它计划是线程安全的:实际的数据I/O通过
_SharedFile
对象,它使用
ZipFile
-水平仪
lock
对于阅读,保持自己的私人地位:
def read(self, n=-1):
with self._lock:
if self._writing():
raise ValueError("Can't read from the ZIP file while there "
"is an open writing handle on it. "
"Close the writing handle before trying to read.")
self._file.seek(self._pos)
data = self._file.read(n)
self._pos = self._file.tell()
return data
你可以试试看
_seekable
关于
ZipFile
,但通常情况下
True
.