[pypy-commit] pypy py3.5-noninherit: Translation fixes
arigo
pypy.commits at gmail.com
Sat Aug 27 05:14:35 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3.5-noninherit
Changeset: r86595:93d0ce98997d
Date: 2016-08-27 11:14 +0200
http://bitbucket.org/pypy/pypy/changeset/93d0ce98997d/
Log: Translation fixes
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
@@ -544,7 +544,8 @@
socketaccept = external('accept', [socketfd_type, sockaddr_ptr,
socklen_t_ptr], socketfd_type,
save_err=SAVE_ERR)
-if cConfig.HAVE_ACCEPT4:
+HAVE_ACCEPT4 = cConfig.HAVE_ACCEPT4
+if HAVE_ACCEPT4:
socketaccept4 = external('accept4', [socketfd_type, sockaddr_ptr,
socklen_t_ptr, rffi.INT],
socketfd_type,
diff --git a/rpython/rlib/rsocket.py b/rpython/rlib/rsocket.py
--- a/rpython/rlib/rsocket.py
+++ b/rpython/rlib/rsocket.py
@@ -8,6 +8,7 @@
# XXX this does not support yet the least common AF_xxx address families
# supported by CPython. See http://bugs.pypy.org/issue1942
+from errno import EINVAL
from rpython.rlib import _rsocket_rffi as _c, jit, rgc
from rpython.rlib.objectmodel import instantiate, keepalive_until_here
from rpython.rlib.rarithmetic import intmask, r_uint
@@ -531,7 +532,7 @@
# then we fall back to the SOCK_CLOEXEC-less case.
fd = _c.socket(family, type | SOCK_CLOEXEC, proto)
if fd < 0:
- if _c.geterrno() == errno.EINVAL:
+ if _c.geterrno() == EINVAL:
# Linux older than 2.6.27 does not support
# SOCK_CLOEXEC. An EINVAL might be caused by
# random other things, though. Don't cache.
@@ -655,8 +656,8 @@
try:
remove_inheritable = not inheritable
if (not inheritable and SOCK_CLOEXEC is not None
- and hasattr(_c, 'socketaccept4') and
- _accept4_syscall.attempt_syscall()):
+ and _c.HAVE_ACCEPT4
+ and _accept4_syscall.attempt_syscall()):
newfd = _c.socketaccept4(self.fd, addr_p, addrlen_p,
SOCK_CLOEXEC)
if _accept4_syscall.fallback(newfd):
@@ -1144,7 +1145,7 @@
res = _c.socketpair(family, type | SOCK_CLOEXEC,
proto, result)
if res < 0:
- if _c.geterrno() == errno.EINVAL:
+ if _c.geterrno() == EINVAL:
# Linux older than 2.6.27 does not support
# SOCK_CLOEXEC. An EINVAL might be caused by
# random other things, though. Don't cache.
More information about the pypy-commit
mailing list