[pypy-commit] pypy hpy: remove the error argument from @apifunc. It was unused and we decided to use a different approach for exceptions anyway

antocuni pypy.commits at gmail.com
Mon Nov 18 17:35:59 EST 2019


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: hpy
Changeset: r98121:5c9a3fd99fc7
Date: 2019-11-18 23:28 +0100
http://bitbucket.org/pypy/pypy/changeset/5c9a3fd99fc7/

Log:	remove the error argument from @apifunc. It was unused and we
	decided to use a different approach for exceptions anyway

diff --git a/pypy/module/hpy_universal/interp_hpy.py b/pypy/module/hpy_universal/interp_hpy.py
--- a/pypy/module/hpy_universal/interp_hpy.py
+++ b/pypy/module/hpy_universal/interp_hpy.py
@@ -14,9 +14,7 @@
 from pypy.module.cpyext.api import generic_cpy_call_dont_convert_result
 
 
-def apifunc(argtypes, restype, error):
-    # XXX: at the moment, error is ignored. We should do something with it
-    # and handle exceptions properly
+def apifunc(argtypes, restype):
     def decorate(fn):
         ll_functype = lltype.Ptr(lltype.FuncType(argtypes, restype))
         @specialize.memo()
@@ -32,8 +30,7 @@
     return decorate
 
 
- at apifunc([llapi.HPyContext, lltype.Ptr(llapi.HPyModuleDef)],
-         llapi.HPy, error=0)
+ at apifunc([llapi.HPyContext, lltype.Ptr(llapi.HPyModuleDef)], llapi.HPy)
 def HPyModule_Create(space, ctx, hpydef):
     modname = rffi.charp2str(hpydef.c_m_name)
     w_mod = Module(space, space.newtext(modname))
@@ -50,20 +47,20 @@
     return handles.new(space, w_mod)
 
 
- at apifunc([llapi.HPyContext, llapi.HPy], llapi.HPy, error=0)
+ at apifunc([llapi.HPyContext, llapi.HPy], llapi.HPy)
 def HPy_Dup(space, ctx, h):
     return handles.dup(space, h)
 
- at apifunc([llapi.HPyContext, llapi.HPy], lltype.Void, error=None)
+ at apifunc([llapi.HPyContext, llapi.HPy], lltype.Void)
 def HPy_Close(space, ctx, h):
     handles.close(space, h)
 
- at apifunc([llapi.HPyContext, rffi.LONG], llapi.HPy, error=0)
+ at apifunc([llapi.HPyContext, rffi.LONG], llapi.HPy)
 def HPyLong_FromLong(space, ctx, value):
     w_obj = space.newint(rffi.cast(lltype.Signed, value))
     return handles.new(space, w_obj)
 
- at apifunc([llapi.HPyContext, llapi.HPy], rffi.LONG, error=0)
+ at apifunc([llapi.HPyContext, llapi.HPy], rffi.LONG)
 def HPyLong_AsLong(space, ctx, h):
     w_obj = handles.deref(space, h)
     #w_obj = space.int(w_obj)     --- XXX write a test for this
@@ -73,14 +70,14 @@
     #    ...
     return result
 
- at apifunc([llapi.HPyContext, llapi.HPy, llapi.HPy], llapi.HPy, error=0)
+ at apifunc([llapi.HPyContext, llapi.HPy, llapi.HPy], llapi.HPy)
 def HPyNumber_Add(space, ctx, h1, h2):
     w_obj1 = handles.deref(space, h1)
     w_obj2 = handles.deref(space, h2)
     w_result = space.add(w_obj1, w_obj2)
     return handles.new(space, w_result)
 
- at apifunc([llapi.HPyContext, rffi.CCHARP], llapi.HPy, error=0)
+ at apifunc([llapi.HPyContext, rffi.CCHARP], llapi.HPy)
 def HPyUnicode_FromString(space, ctx, utf8):
     w_obj = _maybe_utf8_to_w(space, utf8)
     return handles.new(space, w_obj)
@@ -94,7 +91,7 @@
         raise   # XXX do something
     return space.newtext(s, length)
 
- at apifunc([llapi.HPyContext, llapi.HPy, rffi.CCHARP], lltype.Void, error=None)
+ at apifunc([llapi.HPyContext, llapi.HPy, rffi.CCHARP], lltype.Void)
 def HPyErr_SetString(space, ctx, h_exc_type, utf8):
    w_obj = _maybe_utf8_to_w(space, utf8)
    w_exc_type = handles.deref(space, h_exc_type)


More information about the pypy-commit mailing list