summaryrefslogtreecommitdiff
path: root/Lib/_threading_local.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-08-28 18:17:03 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-08-28 18:17:03 +0000
commit22e40d400bdd8191ae91ecac5a8b50a1e18d9193 (patch)
tree0b626273a4e31b9af52f4d2e3239cbe7127bdedb /Lib/_threading_local.py
parent58c1ac90ee697bf6fbe7785cf2ccacd55d4367e0 (diff)
downloadcpython-22e40d400bdd8191ae91ecac5a8b50a1e18d9193.tar.gz
Issue #1868: Eliminate subtle timing issues in thread-local objects by
getting rid of the cached copy of thread-local attribute dictionary.
Diffstat (limited to 'Lib/_threading_local.py')
-rw-r--r--Lib/_threading_local.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/_threading_local.py b/Lib/_threading_local.py
index b0edc031cc..3af780715d 100644
--- a/Lib/_threading_local.py
+++ b/Lib/_threading_local.py
@@ -194,6 +194,10 @@ class local(_localbase):
lock.release()
def __setattr__(self, name, value):
+ if name == '__dict__':
+ raise AttributeError(
+ "%r object attribute '__dict__' is read-only"
+ % self.__class__.__name__)
lock = object.__getattribute__(self, '_local__lock')
lock.acquire()
try:
@@ -203,6 +207,10 @@ class local(_localbase):
lock.release()
def __delattr__(self, name):
+ if name == '__dict__':
+ raise AttributeError(
+ "%r object attribute '__dict__' is read-only"
+ % self.__class__.__name__)
lock = object.__getattribute__(self, '_local__lock')
lock.acquire()
try: