[pypy-commit] pypy default: Clone rffi.liststr2charpp(): in the py3k branch, this function is used both at normal rpython level

amauryfa noreply at buildbot.pypy.org
Mon Jan 28 22:44:52 CET 2013


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r60634:9f7de2ebbe58
Date: 2013-01-28 22:32 +0100
http://bitbucket.org/pypy/pypy/changeset/9f7de2ebbe58/

Log:	Clone rffi.liststr2charpp(): in the py3k branch, this function is
	used both at normal rpython level (in _posixsubprocess module) and
	at a lower-level (in ll_os.py).

	It seems that strings differ between these levels, and two identical
	functions are needed.

diff --git a/rpython/rtyper/lltypesystem/rffi.py b/rpython/rtyper/lltypesystem/rffi.py
--- a/rpython/rtyper/lltypesystem/rffi.py
+++ b/rpython/rtyper/lltypesystem/rffi.py
@@ -867,6 +867,8 @@
     array[len(l)] = lltype.nullptr(CCHARP.TO)
     return array
 liststr2charpp._annenforceargs_ = [[annmodel.s_Str0]]  # List of strings
+# Make a copy for the ll_os.py module
+ll_liststr2charpp = func_with_new_name(liststr2charpp, 'll_liststr2charpp')
 
 def free_charpp(ref):
     """ frees list of char**, NULL terminated
diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py
--- a/rpython/rtyper/module/ll_os.py
+++ b/rpython/rtyper/module/ll_os.py
@@ -306,7 +306,7 @@
                                    rffi.INT, compilation_info = eci)
 
         def execv_llimpl(path, args):
-            l_args = rffi.liststr2charpp(args)
+            l_args = rffi.ll_liststr2charpp(args)
             os_execv(path, l_args)
             rffi.free_charpp(l_args)
             raise OSError(rposix.get_errno(), "execv failed")
@@ -332,8 +332,8 @@
                 envstr = "%s=%s" % item
                 envstrs.append(envstr)
 
-            l_args = rffi.liststr2charpp(args)
-            l_env = rffi.liststr2charpp(envstrs)
+            l_args = rffi.ll_liststr2charpp(args)
+            l_env = rffi.ll_liststr2charpp(envstrs)
             os_execve(path, l_args, l_env)
 
             # XXX untested
@@ -357,7 +357,7 @@
 
         def spawnv_llimpl(mode, path, args):
             mode = rffi.cast(rffi.INT, mode)
-            l_args = rffi.liststr2charpp(args)
+            l_args = rffi.ll_liststr2charpp(args)
             childpid = os_spawnv(mode, path, l_args)
             rffi.free_charpp(l_args)
             if childpid == -1:
@@ -380,8 +380,8 @@
                 envstrs.append("%s=%s" % item)
 
             mode = rffi.cast(rffi.INT, mode)
-            l_args = rffi.liststr2charpp(args)
-            l_env = rffi.liststr2charpp(envstrs)
+            l_args = rffi.ll_liststr2charpp(args)
+            l_env = rffi.ll_liststr2charpp(envstrs)
             childpid = os_spawnve(mode, path, l_args, l_env)
             rffi.free_charpp(l_env)
             rffi.free_charpp(l_args)


More information about the pypy-commit mailing list