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
633db6f6
Commit
633db6f6
authored
Nov 17, 2013
by
Richard Oudkerk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19565: Prevent warnings at shutdown about pending overlapped ops.
parent
80b2aa0a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
Modules/_winapi.c
Modules/_winapi.c
+28
-8
No files found.
Modules/_winapi.c
View file @
633db6f6
...
...
@@ -107,17 +107,37 @@ overlapped_dealloc(OverlappedObject *self)
{
DWORD
bytes
;
int
err
=
GetLastError
();
if
(
self
->
pending
)
{
/* make it a programming error to deallocate while operation
is pending, even if we can safely cancel it */
if
(
check_CancelIoEx
()
&&
Py_CancelIoEx
(
self
->
handle
,
&
self
->
overlapped
))
GetOverlappedResult
(
self
->
handle
,
&
self
->
overlapped
,
&
bytes
,
TRUE
);
PyErr_SetString
(
PyExc_RuntimeError
,
"I/O operations still in flight while destroying "
"Overlapped object, the process may crash"
);
PyErr_WriteUnraisable
(
NULL
);
Py_CancelIoEx
(
self
->
handle
,
&
self
->
overlapped
)
&&
GetOverlappedResult
(
self
->
handle
,
&
self
->
overlapped
,
&
bytes
,
TRUE
))
{
/* The operation is no longer pending -- nothing to do. */
}
else
if
(
_Py_Finalizing
==
NULL
)
{
/* The operation is still pending -- give a warning. This
will probably only happen on Windows XP. */
PyErr_SetString
(
PyExc_RuntimeError
,
"I/O operations still in flight while destroying "
"Overlapped object, the process may crash"
);
PyErr_WriteUnraisable
(
NULL
);
}
else
{
/* The operation is still pending, but the process is
probably about to exit, so we need not worry too much
about memory leaks. Leaking self prevents a potential
crash. This can happen when a daemon thread is cleaned
up at exit -- see #19565. We only expect to get here
on Windows XP. */
CloseHandle
(
self
->
overlapped
.
hEvent
);
SetLastError
(
err
);
return
;
}
}
CloseHandle
(
self
->
overlapped
.
hEvent
);
SetLastError
(
err
);
if
(
self
->
write_buffer
.
obj
)
...
...
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