Trivial optimization of BigArray

This commit is contained in:
Miroslav Stampar
2026-01-28 18:19:27 +01:00
parent e9e0b6a7fe
commit 683c258600
3 changed files with 4 additions and 5 deletions

View File

@@ -187,8 +187,7 @@ class BigArray(list):
try:
handle, filename = tempfile.mkstemp(prefix=MKSTEMP_PREFIX.BIG_ARRAY)
self.filenames.add(filename)
os.close(handle)
with open(filename, "w+b") as f:
with os.fdopen(handle, "w+b") as f:
f.write(zlib.compress(pickle.dumps(chunk, pickle.HIGHEST_PROTOCOL), BIGARRAY_COMPRESS_LEVEL))
return filename
except (OSError, IOError) as ex: