[pypy-commit] pypy py3.5-async: (plan_rich) Fix cast in memoryobject for rpython

raffael_t pypy.commits at gmail.com
Fri Aug 5 14:59:21 EDT 2016


Author: Raffael Tfirst <raffael.tfirst at gmail.com>
Branch: py3.5-async
Changeset: r86042:da8ab61904e8
Date: 2016-08-05 20:58 +0200
http://bitbucket.org/pypy/pypy/changeset/da8ab61904e8/

Log:	(plan_rich) Fix cast in memoryobject for rpython

diff --git a/pypy/module/thread/os_lock.py b/pypy/module/thread/os_lock.py
--- a/pypy/module/thread/os_lock.py
+++ b/pypy/module/thread/os_lock.py
@@ -147,7 +147,8 @@
 def set_sentinel(space):
     """Set a sentinel lock that will be released when the current thread
 state is finalized (after it is untied from the interpreter)."""
-    return space.wrap(Lock(space))
+    lock = allocate_lock(space)
+    return lock
 
 class W_RLock(W_Root):
     def __init__(self, space):
diff --git a/pypy/objspace/std/memoryobject.py b/pypy/objspace/std/memoryobject.py
--- a/pypy/objspace/std/memoryobject.py
+++ b/pypy/objspace/std/memoryobject.py
@@ -226,12 +226,12 @@
             size = rffi.sizeof(rffi.VOIDP)
         return size
     
-    def descr_cast(self, space, w_args, w_kwds):
+    def descr_cast(self, space, w_format, w_shape=None):
         # XXX fixme. does not do anything near cpython (see memoryobjet.c memory_cast)
-        #self._check_released(space)
-        #newitemsize = self.get_native_fmtchar(w_args._val(w_args))
-        return W_MemoryView(self.buf, self.format, self.itemsize)
-        return mv
+        self._check_released(space)
+        fmt = space.str_w(w_format)
+        newitemsize = self.get_native_fmtchar(fmt)
+        return W_MemoryView(self.buf, fmt, newitemsize)
 
 
 W_MemoryView.typedef = TypeDef(


More information about the pypy-commit mailing list