Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
774a66de
Commit
774a66de
authored
Feb 12, 2011
by
R. David Murray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #11116 fix on Windows (close file before removing in MH code)
parent
fc14114c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
Lib/mailbox.py
Lib/mailbox.py
+8
-1
No files found.
Lib/mailbox.py
View file @
774a66de
...
@@ -910,6 +910,7 @@ class MH(Mailbox):
...
@@ -910,6 +910,7 @@ class MH(Mailbox):
new_key
=
max
(
keys
)
+
1
new_key
=
max
(
keys
)
+
1
new_path
=
os
.
path
.
join
(
self
.
_path
,
str
(
new_key
))
new_path
=
os
.
path
.
join
(
self
.
_path
,
str
(
new_key
))
f
=
_create_carefully
(
new_path
)
f
=
_create_carefully
(
new_path
)
closed
=
False
try
:
try
:
if
self
.
_locked
:
if
self
.
_locked
:
_lock_file
(
f
)
_lock_file
(
f
)
...
@@ -917,6 +918,11 @@ class MH(Mailbox):
...
@@ -917,6 +918,11 @@ class MH(Mailbox):
try
:
try
:
self
.
_dump_message
(
message
,
f
)
self
.
_dump_message
(
message
,
f
)
except
BaseException
:
except
BaseException
:
# Unlock and close so it can be deleted on Windows
if
self
.
_locked
:
_unlock_file
(
f
)
_sync_close
(
f
)
closed
=
True
os
.
remove
(
new_path
)
os
.
remove
(
new_path
)
raise
raise
if
isinstance
(
message
,
MHMessage
):
if
isinstance
(
message
,
MHMessage
):
...
@@ -925,7 +931,8 @@ class MH(Mailbox):
...
@@ -925,7 +931,8 @@ class MH(Mailbox):
if
self
.
_locked
:
if
self
.
_locked
:
_unlock_file
(
f
)
_unlock_file
(
f
)
finally
:
finally
:
_sync_close
(
f
)
if
not
closed
:
_sync_close
(
f
)
return
new_key
return
new_key
def
remove
(
self
,
key
):
def
remove
(
self
,
key
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment