[pypy-commit] pypy hpy: some progress in fixing test_ztranslation, which includes improving the fake objspace
antocuni
pypy.commits at gmail.com
Mon Dec 2 06:24:57 EST 2019
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: hpy
Changeset: r98208:abdeda0fd3c6
Date: 2019-11-29 21:37 +0100
http://bitbucket.org/pypy/pypy/changeset/abdeda0fd3c6/
Log: some progress in fixing test_ztranslation, which includes improving
the fake objspace
diff --git a/pypy/module/hpy_universal/interp_unicode.py b/pypy/module/hpy_universal/interp_unicode.py
--- a/pypy/module/hpy_universal/interp_unicode.py
+++ b/pypy/module/hpy_universal/interp_unicode.py
@@ -7,7 +7,7 @@
def _maybe_utf8_to_w(space, utf8):
# should this be a method of space?
- s = rffi.charp2str(utf8)
+ s = rffi.constcharp2str(utf8)
try:
length = rutf8.check_utf8(s, allow_surrogates=False)
except rutf8.CheckError:
diff --git a/pypy/module/hpy_universal/state.py b/pypy/module/hpy_universal/state.py
--- a/pypy/module/hpy_universal/state.py
+++ b/pypy/module/hpy_universal/state.py
@@ -18,7 +18,7 @@
def missing_function():
print ("oops! calling the slot '%s', "
"which is not implemented" % (name,))
- raise OperationError(space.w_NotImplementedError, space.wrap(name))
+ raise OperationError(space.w_NotImplementedError, space.newtext(name))
return missing_function
diff --git a/pypy/objspace/fake/objspace.py b/pypy/objspace/fake/objspace.py
--- a/pypy/objspace/fake/objspace.py
+++ b/pypy/objspace/fake/objspace.py
@@ -77,7 +77,7 @@
return NonConstant(42)
def _len(self):
return self._length
-
+
class W_MyType(W_MyObject):
name = "foobar"
@@ -153,7 +153,13 @@
# In Python2, this is triggered by W_InstanceObject.__getslice__.
def build_slice():
self.newslice(self.w_None, self.w_None, self.w_None)
+ def attach_list_strategy():
+ from pypy.objspace.std.listobject import W_ListObject, EmptyListStrategy
+ w_obj = w_some_obj()
+ if isinstance(w_obj, W_ListObject):
+ w_obj.strategy = EmptyListStrategy(self)
self._seen_extras.append(build_slice)
+ self._seen_extras.append(attach_list_strategy)
def _freeze_(self):
return True
@@ -208,6 +214,10 @@
def newlong(self, x):
return w_some_obj()
+ @specialize.argtype(1)
+ def newlong_from_rarith_int(self, x):
+ return w_some_obj()
+
def newfloat(self, x):
return w_some_obj()
More information about the pypy-commit
mailing list