Update mailbox.py

This commit is contained in:
ShaharNaveh committed 2026-02-14 18:19:57 +02:00
1 parent 13d9c33eb1
commit febe911c85
2 files changed
+2 -8

No files matched your search

+1 -5
View File
@@ -2183,11 +2183,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."""
+1 -3
View File
@@ -1,7 +1,6 @@
import os
import sys
import time
import stat
import socket
import email
import email.message
@@ -13,7 +12,6 @@ from test.support import import_helper
from test.support import os_helper
from test.support import refleak_helper
from test.support import socket_helper
from test.support.testcase import ExtraAssertions
import unittest
import textwrap
import mailbox
@@ -1267,7 +1265,7 @@ class _TestMboxMMDF(_TestSingleFile):
self._box.close()
class TestMbox(_TestMboxMMDF, unittest.TestCase, ExtraAssertions):
class TestMbox(_TestMboxMMDF, unittest.TestCase):
_factory = lambda self, path, factory=None: mailbox.mbox(path, factory)