Author: Armin Rigo <ar...@tunes.org>
Branch: errno-again
Changeset: r75392:770d44c07c9a
Date: 2015-01-16 17:23 +0100
http://bitbucket.org/pypy/pypy/changeset/770d44c07c9a/

Log:    Try to fix things on windows

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
@@ -169,15 +169,18 @@
 
         argnames = ', '.join(['a%d' % i for i in range(len(args))])
         source = py.code.Source("""
-            from rpython.rlib import rposix
+            if %(save_err)d:
+                from rpython.rlib import rposix
 
             def call_external_function(%(argnames)s):
                 before = aroundstate.before
                 if before: before()
                 # NB. it is essential that no exception checking occurs here!
-                rposix._errno_before(%(save_err)d)
+                if %(save_err)d:
+                    rposix._errno_before(%(save_err)d)
                 res = funcptr(%(argnames)s)
-                rposix._errno_after(%(save_err)d)
+                if %(save_err)d:
+                    rposix._errno_after(%(save_err)d)
                 after = aroundstate.after
                 if after: after()
                 return res
@@ -212,12 +215,15 @@
             # to hide it from the JIT...
             argnames = ', '.join(['a%d' % i for i in range(len(args))])
             source = py.code.Source("""
-                from rpython.rlib import rposix
+                if %(save_err)d:
+                    from rpython.rlib import rposix
 
                 def call_external_function(%(argnames)s):
-                    rposix._errno_before(%(save_err)d)
+                    if %(save_err)d:
+                        rposix._errno_before(%(save_err)d)
                     res = funcptr(%(argnames)s)
-                    rposix._errno_after(%(save_err)d)
+                    if %(save_err)d:
+                        rposix._errno_after(%(save_err)d)
                     return res
             """ % locals())
             miniglobals = {'funcptr':     funcptr,
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to