[pypy-svn] r19574 - pypy/dist/pypy/module/thread
arigo at codespeak.net
arigo at codespeak.net
Sun Nov 6 09:59:15 CET 2005
Author: arigo
Date: Sun Nov 6 09:59:13 2005
New Revision: 19574
Modified:
pypy/dist/pypy/module/thread/os_local.py
Log:
Forgot a dict that used strings instead of ints as keys because the RTyper did
not support the latter.
Modified: pypy/dist/pypy/module/thread/os_local.py
==============================================================================
--- pypy/dist/pypy/module/thread/os_local.py (original)
+++ pypy/dist/pypy/module/thread/os_local.py Sun Nov 6 09:59:13 2005
@@ -17,18 +17,16 @@
self.space = space
self.initargs = initargs
ident = thread.get_ident()
- # XXX use string-keyed dicts only for now
- self.dicts = {str(ident): space.newdict([])}
+ self.dicts = {ident: space.newdict([])}
def getdict(self):
ident = thread.get_ident()
- key = str(ident)
try:
- w_dict = self.dicts[key]
+ w_dict = self.dicts[ident]
except KeyError:
# create a new dict for this thread
space = self.space
- w_dict = self.dicts[key] = space.newdict([])
+ w_dict = self.dicts[ident] = space.newdict([])
# call __init__
try:
w_self = space.wrap(self)
@@ -37,7 +35,7 @@
space.call_args(w_init, self.initargs.prepend(w_self))
except:
# failed, forget w_dict and propagate the exception
- del self.dicts[key]
+ del self.dicts[ident]
raise
# ready
space.threadlocals.atthreadexit(space, finish_thread, self)
@@ -49,7 +47,7 @@
space.wrap("setting dictionary to a non-dict"))
self.getdict() # force a dict to exist first
ident = thread.get_ident()
- self.dicts[str(ident)] = w_dict
+ self.dicts[ident] = w_dict
def descr_local__new__(space, w_subtype, __args__):
# XXX check __args__
@@ -72,4 +70,4 @@
def finish_thread(w_obj):
assert isinstance(w_obj, Local)
ident = thread.get_ident()
- del w_obj.dicts[str(ident)]
+ del w_obj.dicts[ident]
More information about the Pypy-commit
mailing list