Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Lib/mailbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -2181,11 +2181,7 @@ def _unlock_file(f):

def _create_carefully(path):
"""Create a file if it doesn't exist and open for reading and writing."""
fd = os.open(path, os.O_CREAT | os.O_EXCL | os.O_RDWR, 0o666)
try:
return open(path, 'rb+')
finally:
os.close(fd)
return open(path, 'xb+')

def _create_temporary(path):
"""Create a temp file based on path and open for reading and writing."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mailbox: Fixed a bug in :mod:mailbox where the precise timing of an external event could result in the library opening an existing file instead of a file it expected to create.
Loading