Author: Richard Plangger <[email protected]>
Branch: memoryview-attributes
Changeset: r86391:61d7052feef7
Date: 2016-08-22 10:31 +0200
http://bitbucket.org/pypy/pypy/changeset/61d7052feef7/

Log:    micro numpy translation fix (descr___buffer__ missing on W_Root),
        used wrap instead of newbytes (not present on TinyObjSpace)

diff --git a/pypy/module/_jitlog/test/test__jitlog.py 
b/pypy/module/_jitlog/test/test__jitlog.py
--- a/pypy/module/_jitlog/test/test__jitlog.py
+++ b/pypy/module/_jitlog/test/test__jitlog.py
@@ -10,10 +10,10 @@
 
     def setup_class(cls):
         cls.w_tmpfilename = cls.space.wrap(str(udir.join('test__jitlog.1')))
-        cls.w_mark_header = cls.space.newbytes(jl.MARK_JITLOG_HEADER)
-        cls.w_version = cls.space.newbytes(jl.JITLOG_VERSION_16BIT_LE)
+        cls.w_mark_header = cls.space.wrap(jl.MARK_JITLOG_HEADER)
+        cls.w_version = cls.space.wrap(jl.JITLOG_VERSION_16BIT_LE)
         cls.w_is_32bit = cls.space.wrap(sys.maxint == 2**31-1)
-        cls.w_machine = cls.space.newbytes(platform.machine())
+        cls.w_machine = cls.space.wrap(platform.machine())
         cls.w_resops = cls.space.newdict()
         space = cls.space
         for key, value in opname.items():
diff --git a/pypy/module/micronumpy/compile.py 
b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -19,7 +19,6 @@
     UserDelAction)
 from pypy.interpreter.pyframe import PyFrame
 
-
 class BogusBytecode(Exception):
     pass
 
@@ -383,6 +382,9 @@
         # XXX even the hacks have hacks
         if s == 'size': # used in _array() but never called by tests
             return IntObject(0)
+        if s == '__buffer__':
+            # descr___buffer__ does not exist on W_Root
+            return self.w_None
         return getattr(w_obj, 'descr_' + s)(self, *args)
 
     @specialize.arg(1)
diff --git a/pypy/module/micronumpy/ctors.py b/pypy/module/micronumpy/ctors.py
--- a/pypy/module/micronumpy/ctors.py
+++ b/pypy/module/micronumpy/ctors.py
@@ -468,7 +468,7 @@
     except OperationError as e:
         if not e.match(space, space.w_TypeError):
             raise
-        w_buffer = space.call_method(w_buffer, '__buffer__', 0)
+        w_buffer = space.call_method(w_buffer, '__buffer__', space.wrap(0))
         buf = _getbuffer(space, w_buffer)
 
     ts = buf.getlength()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to