Skip to content

Commit

Permalink
FIX: Replaced mktemp usage for PY2
Browse files Browse the repository at this point in the history
  • Loading branch information
fazledyn-or authored and auvipy committed Nov 5, 2023
1 parent 17037e5 commit ddb2858
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions billiard/heap.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,12 @@ def __init__(self, size, fd=-1):
f.write(b'\0' * (size % bs))
assert f.tell() == size
else:
name = tempfile.mktemp(
self.fd, name = tempfile.mkstemp(
prefix='pym-%d-' % (os.getpid(),),
dir=util.get_temp_dir(),
)
self.fd = os.open(
name, os.O_RDWR | os.O_CREAT | os.O_EXCL, 0o600,
)
util.Finalize(self, os.close, (self.fd,))
os.unlink(name)
util.Finalize(self, os.close, (self.fd,))
os.ftruncate(self.fd, size)
self.buffer = mmap.mmap(self.fd, self.size)

Expand Down

0 comments on commit ddb2858

Please sign in to comment.