summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-12-18 19:00:16 +0100
committerAntoine Pitrou <solipsis@pitrou.net>2011-12-18 19:00:16 +0100
commit0da3531a6234054d1da980a506c27f35a2c45046 (patch)
tree5334d806cae602ca823a564d37fa7412ab158d19
parent7554147d9ca9b6c98b597f757016a81675f96b6d (diff)
parent4f6e604eae8e51caf6be73e04fc1af98ea2c8d69 (diff)
downloadcpython-0da3531a6234054d1da980a506c27f35a2c45046.tar.gz
Merge
-rw-r--r--Lib/threading.py11
-rw-r--r--Lib/urllib/request.py2
-rw-r--r--Misc/NEWS6
3 files changed, 10 insertions, 9 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 8d505b7d65..2362be69b5 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1047,21 +1047,18 @@ def _after_fork():
current = current_thread()
with _active_limbo_lock:
for thread in _active.values():
+ # Any lock/condition variable may be currently locked or in an
+ # invalid state, so we reinitialize them.
+ thread._reset_internal_locks()
if thread is current:
# There is only one active thread. We reset the ident to
# its new value since it can have changed.
ident = get_ident()
thread._ident = ident
- # Any condition variables hanging off of the active thread may
- # be in an invalid state, so we reinitialize them.
- thread._reset_internal_locks()
new_active[ident] = thread
else:
# All the others are already stopped.
- # We don't call _Thread__stop() because it tries to acquire
- # thread._Thread__block which could also have been held while
- # we forked.
- thread._stopped = True
+ thread._stop()
_limbo.clear()
_active.clear()
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 3a472f235f..8bf15d8007 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -1762,7 +1762,6 @@ class URLopener:
def http_error_default(self, url, fp, errcode, errmsg, headers):
"""Default error handler: close the connection and raise IOError."""
- void = fp.read()
fp.close()
raise HTTPError(url, errcode, errmsg, headers, None)
@@ -1951,7 +1950,6 @@ class FancyURLopener(URLopener):
newurl = headers['uri']
else:
return
- void = fp.read()
fp.close()
# In case the server sent a relative URL, join with original:
diff --git a/Misc/NEWS b/Misc/NEWS
index 286192ce72..2114c4bdc4 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -419,6 +419,12 @@ Core and Builtins
Library
-------
+- Issue #11870: threading: Properly reinitialize threads internal locks and
+ condition variables to avoid deadlocks in child processes.
+
+- Issue #8035: urllib: Fix a bug where the client could remain stuck after a
+ redirection or an error.
+
- Issue #13560: os.strerror() now uses the current locale encoding instead of
UTF-8.