[pypy-commit] pypy default: Translation fixes

amauryfa noreply at buildbot.pypy.org
Thu Feb 23 21:19:57 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: 
Changeset: r52823:f50a42098ae3
Date: 2012-02-23 16:02 +0100
http://bitbucket.org/pypy/pypy/changeset/f50a42098ae3/

Log:	Translation fixes

diff --git a/pypy/module/cpyext/eval.py b/pypy/module/cpyext/eval.py
--- a/pypy/module/cpyext/eval.py
+++ b/pypy/module/cpyext/eval.py
@@ -138,8 +138,9 @@
 
     Returns the result of executing the code as a Python object, or NULL if an
     exception was raised."""
+    source = rffi.charp2str(source)
     if flagsptr:
-        flags = flagsptr.c_cf_flags
+        flags = rffi.cast(lltype.Signed, flagsptr.c_cf_flags)
     else:
         flags = 0
     w_code = compile_string(space, source, "<string>", start, flags)
@@ -197,7 +198,7 @@
     source = rffi.charp2str(source)
     filename = rffi.charp2str(filename)
     if flagsptr:
-        flags = flagsptr.c_cf_flags
+        flags = rffi.cast(lltype.Signed, flagsptr.c_cf_flags)
     else:
         flags = 0
     return compile_string(space, source, filename, start, flags)
@@ -206,18 +207,20 @@
 def PyEval_MergeCompilerFlags(space, cf):
     """This function changes the flags of the current evaluation
     frame, and returns true on success, false on failure."""
-    result = cf.c_cf_flags != 0
+    flags = rffi.cast(lltype.Signed, cf.c_cf_flags)
+    result = flags != 0
     current_frame = space.getexecutioncontext().gettopframe_nohidden()
     if current_frame:
         codeflags = current_frame.pycode.co_flags
         compilerflags = codeflags & PyCF_MASK
         if compilerflags:
-            result = 1;
-            cf.c_cf_flags |= compilerflags
+            result = 1
+            flags |= compilerflags
         # No future keyword at the moment
         # if codeflags & CO_GENERATOR_ALLOWED:
         #     result = 1
-        #     cf.c_cf_flags |= CO_GENERATOR_ALLOWED
+        #     flags |= CO_GENERATOR_ALLOWED
+    cf.c_cf_flags = rffi.cast(rffi.INT, flags)
     return result
 
         


More information about the pypy-commit mailing list