[pypy-commit] pypy null_byte_after_str: fix

arigo pypy.commits at gmail.com
Sun Jul 31 05:41:26 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: null_byte_after_str
Changeset: r85949:a51e4cb76c3b
Date: 2016-07-31 11:43 +0200
http://bitbucket.org/pypy/pypy/changeset/a51e4cb76c3b/

Log:	fix

diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py
--- a/rpython/rlib/objectmodel.py
+++ b/rpython/rlib/objectmodel.py
@@ -281,7 +281,10 @@
         return lltype.Signed
 
 malloc_zero_filled = CDefinedIntSymbolic('MALLOC_ZERO_FILLED', default=0)
-translated_to_c = CDefinedIntSymbolic('1 /* translated_to_c */', default=0)
+_translated_to_c = CDefinedIntSymbolic('1 /*_translated_to_c*/', default=0)
+
+def we_are_translated_to_c():
+    return we_are_translated() and _translated_to_c
 
 # ____________________________________________________________
 
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
@@ -15,7 +15,7 @@
 from rpython.rtyper.tool.rfficache import platform, sizeof_c_type
 from rpython.translator.tool.cbuild import ExternalCompilationInfo
 from rpython.rtyper.annlowlevel import llhelper
-from rpython.rlib.objectmodel import we_are_translated, translated_to_c
+from rpython.rlib.objectmodel import we_are_translated, we_are_translated_to_c
 from rpython.rlib.rstring import StringBuilder, UnicodeBuilder, assert_str0
 from rpython.rlib import jit
 from rpython.rtyper.lltypesystem import llmemory
@@ -837,10 +837,10 @@
         lldata = llstrtype(data)
         count = len(data)
 
-        if translated_to_c and not rgc.can_move(data):
+        if we_are_translated_to_c() and not rgc.can_move(data):
             flag = '\x04'
         else:
-            if translated_to_c and rgc.pin(data):
+            if we_are_translated_to_c() and rgc.pin(data):
                 flag = '\x05'
             else:
                 buf = lltype.malloc(TYPEP.TO, count + (TYPEP is CCHARP),


More information about the pypy-commit mailing list