Author: Wim Lavrijsen <[email protected]>
Branch: cppyy-dev
Changeset: r97991:8f3cf9c3225b
Date: 2019-11-07 15:54 -0800
http://bitbucket.org/pypy/pypy/changeset/8f3cf9c3225b/
Log: rtype fixers to make test_zjit run
diff --git a/pypy/module/_cppyy/capi/loadable_capi.py
b/pypy/module/_cppyy/capi/loadable_capi.py
--- a/pypy/module/_cppyy/capi/loadable_capi.py
+++ b/pypy/module/_cppyy/capi/loadable_capi.py
@@ -30,9 +30,10 @@
class _Arg: # poor man's union
_immutable_ = True
- def __init__(self, tc, h = 0, l = -1, d = -1., s = '', p =
rffi.cast(rffi.VOIDP, 0)):
+ def __init__(self, tc, h = 0, u = 0, l = -1, d = -1., s = '', p =
rffi.cast(rffi.VOIDP, 0)):
self.tc = tc
self._handle = h
+ self._index = u
self._long = l
self._double = d
self._string = s
@@ -43,7 +44,10 @@
def __init__(self, val):
_Arg.__init__(self, 'h', h = val)
-_ArgU = _ArgH # simple re-use for indices (size_t)
+class _ArgU(_Arg): # separate class for rtyper
+ _immutable_ = True
+ def __init__(self, val):
+ _Arg.__init__(self, 'u', u = val)
class _ArgL(_Arg):
_immutable_ = True
@@ -99,7 +103,10 @@
misc.write_raw_signed_data(data, rffi.cast(rffi.LONG,
obj._long), argtype.size)
elif obj.tc == 'h':
assert isinstance(argtype,
ctypeprim.W_CTypePrimitiveUnsigned)
- misc.write_raw_unsigned_data(data, rffi.cast(rffi.ULONG,
obj._handle), argtype.size)
+ misc.write_raw_unsigned_data(data,
rffi.cast(rffi.UINTPTR_T, obj._handle), argtype.size)
+ elif obj.tc == 'u':
+ assert isinstance(argtype,
ctypeprim.W_CTypePrimitiveUnsigned)
+ misc.write_raw_unsigned_data(data, rffi.cast(rffi.SIZE_T,
obj._index), argtype.size)
elif obj.tc == 'p':
assert obj._voidp != rffi.cast(rffi.VOIDP, 0)
data = rffi.cast(rffi.VOIDPP, data)
diff --git a/pypy/module/_cppyy/test/test_zjit.py
b/pypy/module/_cppyy/test/test_zjit.py
--- a/pypy/module/_cppyy/test/test_zjit.py
+++ b/pypy/module/_cppyy/test/test_zjit.py
@@ -230,6 +230,9 @@
assert isinstance(w_obj, FakeString)
return w_obj.val
+ def fsencode_w(self, w_obj):
+ return self.bytes_w(w_obj)
+
def text_w(self, w_obj):
assert isinstance(w_obj, FakeString)
return w_obj.val
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit