[pypy-commit] pypy default: fix test on win32, also cleanup uneeded export of function from libpypy

mattip pypy.commits at gmail.com
Sun Nov 11 00:01:00 EST 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: 
Changeset: r95291:286138f59bc3
Date: 2018-11-10 20:55 -0800
http://bitbucket.org/pypy/pypy/changeset/286138f59bc3/

Log:	fix test on win32, also cleanup uneeded export of function from
	libpypy

diff --git a/pypy/module/sys/initpath.py b/pypy/module/sys/initpath.py
--- a/pypy/module/sys/initpath.py
+++ b/pypy/module/sys/initpath.py
@@ -188,8 +188,8 @@
 #endif
 #include <windows.h>
 #include <stdio.h>
+#include <stdlib.h>
 
-RPY_EXPORTED
 char *_pypy_init_home(void)
 {
     HMODULE hModule = 0;
@@ -225,7 +225,6 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-RPY_EXPORTED
 char *_pypy_init_home(void)
 {
     Dl_info info;
@@ -243,11 +242,27 @@
 }
 """
 
+_source_code += """
+inline
+void _pypy_init_free(char *p)
+{
+    free(p);
+}
+"""
+
+if we_are_translated():
+   post_include_bits = []
+else:
+    # for tests 
+    post_include_bits=['RPY_EXPORTED char *_pypy_init_home(void);',
+                       'RPY_EXPORTED void _pypy_init_free(char*);',
+                      ]
+
 _eci = ExternalCompilationInfo(separate_module_sources=[_source_code],
-    post_include_bits=['RPY_EXPORTED char *_pypy_init_home(void);'])
+                               post_include_bits=post_include_bits)
 _eci = _eci.merge(rdynload.eci)
 
 pypy_init_home = rffi.llexternal("_pypy_init_home", [], rffi.CCHARP,
                                  _nowrapper=True, compilation_info=_eci)
-pypy_init_free = rffi.llexternal("free", [rffi.CCHARP], lltype.Void,
+pypy_init_free = rffi.llexternal("_pypy_init_free", [rffi.CCHARP], lltype.Void,
                                  _nowrapper=True, compilation_info=_eci)


More information about the pypy-commit mailing list