Author: Carl Friedrich Bolz <cfb...@gmx.de> Branch: space-newtext Changeset: r88124:6301ac648043 Date: 2016-11-03 15:01 +0100 http://bitbucket.org/pypy/pypy/changeset/6301ac648043/
Log: _multiprocessing diff --git a/pypy/module/_multiprocessing/interp_connection.py b/pypy/module/_multiprocessing/interp_connection.py --- a/pypy/module/_multiprocessing/interp_connection.py +++ b/pypy/module/_multiprocessing/interp_connection.py @@ -22,18 +22,18 @@ def init(self, space): w_builtins = space.getbuiltinmodule('__builtin__') w_module = space.call_method( - w_builtins, '__import__', space.wrap("multiprocessing")) - self.w_BufferTooShort = space.getattr(w_module, space.wrap("BufferTooShort")) + w_builtins, '__import__', space.newtext("multiprocessing")) + self.w_BufferTooShort = space.getattr(w_module, space.newtext("BufferTooShort")) self.w_picklemodule = space.call_method( - w_builtins, '__import__', space.wrap("pickle")) + w_builtins, '__import__', space.newtext("pickle")) def BufferTooShort(space, w_data): w_BufferTooShort = space.fromcache(State).w_BufferTooShort return OperationError(w_BufferTooShort, w_data) def w_handle(space, handle): - return space.wrap(rffi.cast(rffi.INTPTR_T, handle)) + return space.newint(rffi.cast(rffi.INTPTR_T, handle)) class W_BaseConnection(W_Root): @@ -80,7 +80,7 @@ def _repr(self, space, handle): conn_type = ["read-only", "write-only", "read-write"][self.flags - 1] - return space.wrap("<%s %s, handle %d>" % ( + return space.newtext("<%s %s, handle %d>" % ( conn_type, space.type(self).getname(space), handle)) def descr_repr(self, space): @@ -145,14 +145,14 @@ if newbuf: rffi.free_charp(newbuf) - return space.wrap(res) + return space.newint(res) def send(self, space, w_obj): self._check_writable(space) w_picklemodule = space.fromcache(State).w_picklemodule w_protocol = space.getattr( - w_picklemodule, space.wrap("HIGHEST_PROTOCOL")) + w_picklemodule, space.newtext("HIGHEST_PROTOCOL")) w_pickled = space.call_method( w_picklemodule, "dumps", w_obj, w_protocol) @@ -254,13 +254,13 @@ self = space.allocate_instance(W_FileConnection, w_subtype) W_FileConnection.__init__(self, space, fd, flags) - return space.wrap(self) + return self def descr_repr(self, space): return self._repr(space, self.fd) def fileno(self, space): - return space.wrap(self.fd) + return space.newint(self.fd) def is_valid(self): return self.fd != self.INVALID_HANDLE_VALUE @@ -379,7 +379,7 @@ self = space.allocate_instance(W_PipeConnection, w_subtype) W_PipeConnection.__init__(self, space, handle, flags) - return space.wrap(self) + return self def descr_repr(self, space): return self._repr(space, rffi.cast(rffi.INTPTR_T, self.handle)) diff --git a/pypy/module/_multiprocessing/interp_semaphore.py b/pypy/module/_multiprocessing/interp_semaphore.py --- a/pypy/module/_multiprocessing/interp_semaphore.py +++ b/pypy/module/_multiprocessing/interp_semaphore.py @@ -445,27 +445,27 @@ return w_handle(space, self.handle) def get_count(self, space): - return space.wrap(self.count) + return space.newint(self.count) def _ismine(self): return self.count > 0 and rthread.get_ident() == self.last_tid def is_mine(self, space): - return space.wrap(self._ismine()) + return space.newbool(self._ismine()) def is_zero(self, space): try: res = semlock_iszero(self, space) except OSError as e: raise wrap_oserror(space, e) - return space.wrap(res) + return space.newbool(res) def get_value(self, space): try: val = semlock_getvalue(self, space) except OSError as e: raise wrap_oserror(space, e) - return space.wrap(val) + return space.newint(val) @unwrap_spec(block=bool) def acquire(self, space, block=True, w_timeout=None): @@ -510,7 +510,7 @@ def rebuild(space, w_cls, w_handle, kind, maxvalue): self = space.allocate_instance(W_SemLock, w_cls) self.__init__(space, handle_w(space, w_handle), kind, maxvalue) - return space.wrap(self) + return self def enter(self, space): return self.acquire(space, w_timeout=space.w_None) @@ -537,7 +537,7 @@ self = space.allocate_instance(W_SemLock, w_subtype) self.__init__(space, handle, kind, maxvalue) - return space.wrap(self) + return self W_SemLock.typedef = TypeDef( "SemLock", _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit