At 16:53 30.06.2004 -0400, Jim Fulton wrote: > def _patch(self): > key = object.__getattribute__(self, '_local__key') > d = currentThread().__dict__.get(key) > if d is None: > d = {} > currentThread().__dict__[key] = d > object.__setattr__(self, '__dict__', d) > > # we have a new instance dict, so call out __init__ if we have > # one > cls = type(self) > if cls.__init__ is not object.__init__: > args, kw = object.__getattribute__(self, '_local__args') > cls.__init__(self, *args, **kw) > else: > object.__setattr__(self, '__dict__', d) > > class local(_localbase): > > def __getattribute__(self, name): > _patch(self) what happens if there's a thread switch, to another thread using the local object, here? between patching __dict__ and accessing __dict__ > return object.__getattribute__(self, name) > > def __setattr__(self, name, value): > _patch(self) > return object.__setattr__(self, name, value) > > def __delattr__(self, name): > _patch(self) > return object.__delattr__(self, name) > > def __del__(self): > key = object.__getattribute__(self, '_local__key') > for thread in enumerate(): > if key in thread.__dict__: > del thread.__dict__[key] > >Any objections? Any more tricks up your sleeve Armin? :) > >Jim > >-- >Jim Fulton mailto:jim at zope.com Python Powered! >CTO (540) 361-1714 http://www.python.org >Zope Corporation http://www.zope.com http://www.zope.org > >_______________________________________________ >Python-Dev mailing list >Python-Dev at python.org >http://mail.python.org/mailman/listinfo/python-dev >Unsubscribe: >http://mail.python.org/mailman/options/python-dev/pedronis%40bluewin.ch
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4