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
66d8dbea
Commit
66d8dbea
authored
Apr 04, 2014
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21149: Improved thread-safety in logging cleanup during interpreter shutdown.
parent
352eb4f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
10 deletions
+15
-10
Lib/logging/__init__.py
Lib/logging/__init__.py
+12
-10
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/__init__.py
View file @
66d8dbea
# Copyright 2001-201
2
by Vinay Sajip. All Rights Reserved.
# Copyright 2001-201
4
by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
...
...
@@ -18,7 +18,7 @@
Logging package for Python. Based on PEP 282 and comments thereto in
comp.lang.python.
Copyright (C) 2001-201
2
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
4
Vinay Sajip. All Rights Reserved.
To use, simply 'import logging' and log away!
"""
...
...
@@ -46,6 +46,7 @@ except ImportError:
__author__
=
"Vinay Sajip <vinay_sajip@red-dove.com>"
__status__
=
"production"
# Note: the attributes below are no longer maintained.
__version__
=
"0.5.1.2"
__date__
=
"07 February 2010"
...
...
@@ -622,16 +623,17 @@ def _removeHandlerRef(wr):
Remove a handler reference from the internal cleanup list.
"""
# This function can be called during module teardown, when globals are
# set to None. If _acquireLock is None, assume this is the case and do
# nothing.
if
(
_acquireLock
is
not
None
and
_handlerList
is
not
None
and
_releaseLock
is
not
None
):
_acquireLock
()
# set to None. It can also be called from another thread. So we need to
# pre-emptively grab the necessary globals and check if they're None,
# to prevent race conditions and failures during interpreter shutdown.
acquire
,
release
,
handlers
=
_acquireLock
,
_releaseLock
,
_handlerList
if
acquire
and
release
and
handlers
:
acquire
()
try
:
if
wr
in
_handlerList
:
_handlerList
.
remove
(
wr
)
if
wr
in
handlers
:
handlers
.
remove
(
wr
)
finally
:
_releaseLock
()
release
()
def
_addHandlerRef
(
handler
):
"""
...
...
Misc/NEWS
View file @
66d8dbea
...
...
@@ -43,6 +43,9 @@ Core and Builtins
Library
-------
-
Issue
#
21149
:
Improved
thread
-
safety
in
logging
cleanup
during
interpreter
shutdown
.
Thanks
to
Devin
Jeanpierre
for
the
patch
.
-
Fix
possible
overflow
bug
in
strop
.
expandtabs
.
You
shouldn
't be using this
module!
...
...
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