[pypy-svn] r77806 - in pypy/branch/fast-forward/pypy/module/_multiprocessing: . test
afa at codespeak.net
afa at codespeak.net
Mon Oct 11 19:16:20 CEST 2010
Author: afa
Date: Mon Oct 11 19:16:18 2010
New Revision: 77806
Modified:
pypy/branch/fast-forward/pypy/module/_multiprocessing/interp_semaphore.py
pypy/branch/fast-forward/pypy/module/_multiprocessing/test/test_semaphore.py
Log:
Arg, SemLock._rebuild is a classmethod.
Modified: pypy/branch/fast-forward/pypy/module/_multiprocessing/interp_semaphore.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_multiprocessing/interp_semaphore.py (original)
+++ pypy/branch/fast-forward/pypy/module/_multiprocessing/interp_semaphore.py Mon Oct 11 19:16:18 2010
@@ -428,11 +428,11 @@
self.count -= 1
- @unwrap_spec('self', ObjSpace, W_Root, int, int)
- def rebuild(self, space, w_handle, kind, maxvalue):
- self.handle = handle_w(space, w_handle)
- self.kind = kind
- self.maxvalue = maxvalue
+ @unwrap_spec(ObjSpace, W_Root, W_Root, int, int)
+ def rebuild(space, w_cls, w_handle, kind, maxvalue):
+ self = space.allocate_instance(W_SemLock, w_cls)
+ self.__init__(handle_w(space, w_handle), kind, maxvalue)
+ return space.wrap(self)
@unwrap_spec(ObjSpace, W_Root, int, int, int)
def descr_new(space, w_subtype, kind, value, maxvalue):
@@ -460,6 +460,6 @@
_is_mine = interp2app(W_SemLock.is_mine),
acquire = interp2app(W_SemLock.acquire),
release = interp2app(W_SemLock.release),
- _rebuild = interp2app(W_SemLock.rebuild),
+ _rebuild = interp2app(W_SemLock.rebuild.im_func, as_classmethod=True),
SEM_VALUE_MAX=SEM_VALUE_MAX,
)
Modified: pypy/branch/fast-forward/pypy/module/_multiprocessing/test/test_semaphore.py
==============================================================================
--- pypy/branch/fast-forward/pypy/module/_multiprocessing/test/test_semaphore.py (original)
+++ pypy/branch/fast-forward/pypy/module/_multiprocessing/test/test_semaphore.py Mon Oct 11 19:16:18 2010
@@ -44,4 +44,5 @@
maxvalue = 1
sem = SemLock(kind, value, maxvalue)
- sem._rebuild(sem.handle, kind, value)
+ sem2 = SemLock._rebuild(sem.handle, kind, value)
+ assert sem.handle == sem2.handle
More information about the Pypy-commit
mailing list