[pypy-commit] pypy default: graft rpython changes from py3.5, maybe we should enforce sycnronization with a test?
mattip
pypy.commits at gmail.com
Mon Oct 30 13:12:35 EDT 2017
Author: Matti Picus <matti.picus at gmail.com>
Branch:
Changeset: r92884:80602ff2f2d3
Date: 2017-10-30 18:51 +0200
http://bitbucket.org/pypy/pypy/changeset/80602ff2f2d3/
Log: graft rpython changes from py3.5, maybe we should enforce
sycnronization with a test?
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
@@ -162,7 +162,7 @@
IP_RECVRETOPTS IP_RETOPTS IP_TOS IP_TTL
MSG_BTAG MSG_ETAG MSG_CTRUNC MSG_DONTROUTE MSG_DONTWAIT MSG_EOR MSG_OOB
-MSG_PEEK MSG_TRUNC MSG_WAITALL
+MSG_PEEK MSG_TRUNC MSG_WAITALL MSG_ERRQUEUE
NI_DGRAM NI_MAXHOST NI_MAXSERV NI_NAMEREQD NI_NOFQDN NI_NUMERICHOST
NI_NUMERICSERV
@@ -348,7 +348,8 @@
('ifr_name', rffi.CFixedArray(rffi.CHAR, 8))])
# insert handler for sendmsg / recvmsg here
-if _POSIX:
+HAVE_SENDMSG = bool(_POSIX)
+if HAVE_SENDMSG:
includes = ['stddef.h',
'sys/socket.h',
'unistd.h',
@@ -534,7 +535,7 @@
int cmsg_status;
struct iovec iov;
struct recvmsg_info* retinfo;
- int error_flag; // variable to be set in case of special errors.
+ int error_flag = 0; // variable to be set in case of special errors.
int cmsgdatalen = 0;
// variables that are set to 1, if the message charp has been allocated
@@ -708,6 +709,7 @@
free(retinfo);
}
}
+ if (error_flag==0) error_flag = -1;
return error_flag;
err_closefds:
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -472,7 +472,7 @@
def close(fd):
validate_fd(fd)
handle_posix_error('close', c_close(fd))
-
+
c_lseek = external('_lseeki64' if _WIN32 else 'lseek',
[rffi.INT, rffi.LONGLONG, rffi.INT], rffi.LONGLONG,
macro=_MACRO_ON_POSIX, save_err=rffi.RFFI_SAVE_ERRNO)
@@ -505,7 +505,7 @@
with rffi.scoped_alloc_buffer(count) as buf:
void_buf = rffi.cast(rffi.VOIDP, buf.raw)
return buf.str(handle_posix_error('pread', c_pread(fd, void_buf, count, offset)))
-
+
@enforceargs(int, None, None)
def pwrite(fd, data, offset):
count = len(data)
@@ -1851,6 +1851,8 @@
rffi.INT, save_err=rffi.RFFI_FULL_ERRNO_ZERO)
c_sched_get_priority_min = external('sched_get_priority_min', [rffi.INT],
rffi.INT, save_err=rffi.RFFI_SAVE_ERRNO)
+ if not _WIN32:
+ c_sched_yield = external('sched_yield', [], rffi.INT)
@enforceargs(int)
def sched_get_priority_max(policy):
@@ -1860,8 +1862,8 @@
def sched_get_priority_min(policy):
return handle_posix_error('sched_get_priority_min', c_sched_get_priority_min(policy))
-
-
+ def sched_yield():
+ return handle_posix_error('sched_yield', c_sched_yield())
#___________________________________________________________________
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -1074,7 +1074,7 @@
if address is not None:
address.unlock()
- if _c.geterrno() == _c.EINTR:
+ if (_c.geterrno() == _c.EINTR) or (_c.geterrno() == 11):
raise last_error()
if (reply == -10000):
raise RSocketError("Invalid message size")
@@ -1393,7 +1393,7 @@
return (make_socket(fd0, family, type, proto, SocketClass),
make_socket(fd1, family, type, proto, SocketClass))
-if _c._POSIX:
+if _c.HAVE_SENDMSG:
def CMSG_LEN( demanded_len):
"""
Socket method to determine the optimal byte size of the ancillary.
diff --git a/rpython/rlib/test/test_rposix.py b/rpython/rlib/test/test_rposix.py
--- a/rpython/rlib/test/test_rposix.py
+++ b/rpython/rlib/test/test_rposix.py
@@ -676,7 +676,7 @@
prio = rposix.getpriority(rposix.PRIO_PROCESS, 0)
rposix.setpriority(rposix.PRIO_PROCESS, 0, prio)
py.test.raises(OSError, rposix.getpriority, rposix.PRIO_PGRP, 123456789)
-
+
if sys.platform != 'win32':
def test_sendfile():
from rpython.rlib import rsocket
@@ -723,7 +723,7 @@
os.close(fd)
s2.close()
s1.close()
-
+
@rposix_requires('pread')
def test_pread():
fname = str(udir.join('os_test.txt'))
@@ -794,14 +794,14 @@
assert rposix.sched_get_priority_max(rposix.SCHED_RR) != -1
assert rposix.sched_get_priority_max(rposix.SCHED_OTHER) != -1
assert rposix.sched_get_priority_max(rposix.SCHED_BATCH) != -1
-
+
@rposix_requires('sched_get_priority_min')
def test_sched_get_priority_min():
assert rposix.sched_get_priority_min(rposix.SCHED_FIFO) != -1
assert rposix.sched_get_priority_min(rposix.SCHED_RR) != -1
assert rposix.sched_get_priority_min(rposix.SCHED_OTHER) != -1
assert rposix.sched_get_priority_min(rposix.SCHED_BATCH) != -1
-
+
@rposix_requires('sched_get_priority_min')
def test_os_sched_priority_max_greater_than_min():
policy = rposix.SCHED_RR
@@ -811,3 +811,8 @@
assert isinstance(high, int) == True
assert high > low
+ at rposix_requires('sched_yield')
+def test_sched_yield():
+ if sys.platform != 'win32':
+ rposix.sched_yield()
+
More information about the pypy-commit
mailing list