[pypy-commit] pypy more-rposix: Don't use os.write in gc helper functions.

amauryfa noreply at buildbot.pypy.org
Sat Dec 6 11:42:00 CET 2014


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: more-rposix
Changeset: r74851:c722fad1b5bf
Date: 2014-12-06 11:41 +0100
http://bitbucket.org/pypy/pypy/changeset/c722fad1b5bf/

Log:	Don't use os.write in gc helper functions. This fixes a test where
	os.write is not used in translated function, and is annotated too
	late.

	extfunc.py uses a "mixed-level delayed object" but I don't know how
	to do this here.

diff --git a/rpython/memory/gctransform/support.py b/rpython/memory/gctransform/support.py
--- a/rpython/memory/gctransform/support.py
+++ b/rpython/memory/gctransform/support.py
@@ -73,15 +73,19 @@
         hop.exception_cannot_occur()
         return hop.inputconst(hop.r_result.lowleveltype, hop.s_result.const)
 
+def write(fd, string):
+    from rpython.rlib.rposix import c_write
+    return c_write(fd, string, len(string))
+
 def ll_call_destructor(destrptr, destr_v, typename):
     try:
         destrptr(destr_v)
     except Exception, e:
         try:
-            os.write(2, "a destructor of type ")
-            os.write(2, typename)
-            os.write(2, " raised an exception ")
-            os.write(2, str(e))
-            os.write(2, " ignoring it\n")
+            write(2, "a destructor of type ")
+            write(2, typename)
+            write(2, " raised an exception ")
+            write(2, str(e))
+            write(2, " ignoring it\n")
         except:
             pass


More information about the pypy-commit mailing list