Author: Matti Picus <[email protected]>
Branch: 
Changeset: r96090:2ea6562691b9
Date: 2019-02-19 11:48 +0200
http://bitbucket.org/pypy/pypy/changeset/2ea6562691b9/

Log:    backport rpython changes

diff --git a/rpython/rlib/_rsocket_rffi.py b/rpython/rlib/_rsocket_rffi.py
--- a/rpython/rlib/_rsocket_rffi.py
+++ b/rpython/rlib/_rsocket_rffi.py
@@ -1270,7 +1270,8 @@
 getprotobyname = external('getprotobyname', [rffi.CCHARP], 
lltype.Ptr(cConfig.protoent))
 
 if _POSIX:
-    fcntl = external('fcntl', [socketfd_type, rffi.INT, rffi.INT], rffi.INT)
+    fcntl = external('fcntl', [socketfd_type, rffi.INT, rffi.INT], rffi.INT,
+                     save_err=SAVE_ERR)
     socketpair_t = rffi.CArray(socketfd_type)
     socketpair = external('socketpair', [rffi.INT, rffi.INT, rffi.INT,
                           lltype.Ptr(socketpair_t)], rffi.INT,
@@ -1282,7 +1283,7 @@
 if _WIN32:
     ioctlsocket = external('ioctlsocket',
                            [socketfd_type, rffi.LONG, rffi.ULONGP],
-                           rffi.INT)
+                           rffi.INT, save_err=SAVE_ERR)
 
 select = external('select',
                   [rffi.INT, fd_set, fd_set,
diff --git a/rpython/rlib/rposix_stat.py b/rpython/rlib/rposix_stat.py
--- a/rpython/rlib/rposix_stat.py
+++ b/rpython/rlib/rposix_stat.py
@@ -686,7 +686,7 @@
         # the "reparse points" is missing
         win32traits = make_win32_traits(traits)
 
-        hFile = win32traits.CreateFile(path,
+        hFile = win32traits.CreateFile(traits.as_str0(path),
             win32traits.FILE_READ_ATTRIBUTES,
             0,
             lltype.nullptr(rwin32.LPSECURITY_ATTRIBUTES.TO),
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -567,17 +567,21 @@
     if hasattr(_c, 'fcntl'):
         def _setblocking(self, block):
             orig_delay_flag = intmask(_c.fcntl(self.fd, _c.F_GETFL, 0))
+            if orig_delay_flag == -1:
+                raise self.error_handler()
             if block:
                 delay_flag = orig_delay_flag & ~_c.O_NONBLOCK
             else:
                 delay_flag = orig_delay_flag | _c.O_NONBLOCK
             if orig_delay_flag != delay_flag:
-                _c.fcntl(self.fd, _c.F_SETFL, delay_flag)
+                if _c.fcntl(self.fd, _c.F_SETFL, delay_flag) == -1:
+                    raise self.error_handler()
     elif hasattr(_c, 'ioctlsocket'):
         def _setblocking(self, block):
             flag = lltype.malloc(rffi.ULONGP.TO, 1, flavor='raw')
             flag[0] = rffi.cast(rffi.ULONG, not block)
-            _c.ioctlsocket(self.fd, _c.FIONBIO, flag)
+            if _c.ioctlsocket(self.fd, _c.FIONBIO, flag) != 0:
+                raise self.error_handler()
             lltype.free(flag, flavor='raw')
 
     if hasattr(_c, 'poll') and not _c.poll_may_be_broken:
diff --git a/rpython/rlib/signature.py b/rpython/rlib/signature.py
--- a/rpython/rlib/signature.py
+++ b/rpython/rlib/signature.py
@@ -9,7 +9,7 @@
       def foo(...)
 
     The arguments paramNtype and returntype should be instances
-    of the classes in rpython.annotator.types.
+    of the classes in rpython.rlib.types.
     """
     returntype = kwargs.pop('returns', None)
     if returntype is None:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to