Commit 1dc10357 authored by Denis Bilenko's avatar Denis Bilenko

local: raise AttributeError if '__dict__' attribute is set or deleted

--HG--
extra : transplant_source : %EA%99%1F%0F%C0Gq%98b%A7%0D%95%ABo%14%CF%18k%20f
parent 22871d81
......@@ -185,6 +185,8 @@ class local(_localbase):
return object.__getattribute__(self, name)
def __setattr__(self, name, value):
if name == '__dict__':
raise AttributeError("%r object attribute '__dict__' is read-only" % self.__class__.__name__)
d = object.__getattribute__(self, '_local__dicts').get(getcurrent())
if d is None:
lock = object.__getattribute__(self, '_local__lock')
......@@ -199,6 +201,8 @@ class local(_localbase):
return object.__setattr__(self, name, value)
def __delattr__(self, name):
if name == '__dict__':
raise AttributeError("%r object attribute '__dict__' is read-only" % self.__class__.__name__)
d = object.__getattribute__(self, '_local__dicts').get(getcurrent())
if d is None:
lock = object.__getattribute__(self, '_local__lock')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment