[pypy-commit] pypy hpy: I'm not sure exactly what's happening, but with the double cast we end up with a global array inside ctx->ctx_Arg_Parse; doing this seems to solve the issue

antocuni pypy.commits at gmail.com
Thu Nov 21 13:24:59 EST 2019


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: hpy
Changeset: r98135:160e0b8f64a1
Date: 2019-11-21 19:24 +0100
http://bitbucket.org/pypy/pypy/changeset/160e0b8f64a1/

Log:	I'm not sure exactly what's happening, but with the double cast we
	end up with a global array inside ctx->ctx_Arg_Parse; doing this
	seems to solve the issue

diff --git a/pypy/module/hpy_universal/llapi.py b/pypy/module/hpy_universal/llapi.py
--- a/pypy/module/hpy_universal/llapi.py
+++ b/pypy/module/hpy_universal/llapi.py
@@ -114,8 +114,6 @@
 
 # NOTE: this is not the real signature (we don't know what to put for
 # va_list), but it's good enough to get the address of the function to store
-# in the ctx. DO NOT CALL THIS!. TO avoid possible mistakes, we directly cast
-# it to VOIDP
-ctx_Arg_Parse_fn = rffi.llexternal('ctx_Arg_Parse', [], rffi.INT_real,
-                                compilation_info=eci, _nowrapper=True)
-ctx_Arg_Parse = rffi.cast(rffi.VOIDP, ctx_Arg_Parse_fn)
+# in the ctx. DO NOT CALL THIS!
+DONT_CALL_ctx_Arg_Parse = rffi.llexternal('ctx_Arg_Parse', [], rffi.INT_real,
+                                          compilation_info=eci, _nowrapper=True)
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
@@ -77,5 +77,4 @@
         funcptr = interp_hpy.HPyErr_SetString.get_llhelper(space)
         self.ctx.c_ctx_Err_SetString = rffi.cast(rffi.VOIDP, funcptr)
         #
-        # the cast is not strictly necessary but silences a gcc warning
-        self.ctx.c_ctx_Arg_Parse = rffi.cast(rffi.VOIDP, llapi.ctx_Arg_Parse)
+        self.ctx.c_ctx_Arg_Parse = rffi.cast(rffi.VOIDP, llapi.DONT_CALL_ctx_Arg_Parse)


More information about the pypy-commit mailing list