Author: Armin Rigo <[email protected]>
Branch: py3.6-sandbox-2
Changeset: r97223:4997ac74778b
Date: 2019-08-20 11:41 +0200
http://bitbucket.org/pypy/pypy/changeset/4997ac74778b/
Log: Use the select module too
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -47,7 +47,7 @@
# --sandbox
sandbox_modules = default_modules.copy()
sandbox_modules.update([
- "array", "binascii", "_socket",
+ "array", "binascii", "_socket", "select",
])
import rpython.rlib.rvmprof.cintf
diff --git a/pypy/module/select/moduledef.py b/pypy/module/select/moduledef.py
--- a/pypy/module/select/moduledef.py
+++ b/pypy/module/select/moduledef.py
@@ -43,3 +43,8 @@
Module.interpleveldefs[name] = "space.wrap(%r)" % value
super(Module, cls).buildloaders()
buildloaders = classmethod(buildloaders)
+
+ def __init__(self, space, w_name):
+ if space.config.translating and space.config.translation.sandbox:
+ self.__class__.interpleveldefs.pop('epoll', None)
+ super(Module, self).__init__(space, w_name)
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
@@ -1185,7 +1185,7 @@
if _POSIX:
dup = external('dup', [socketfd_type], socketfd_type, save_err=SAVE_ERR)
- gai_strerror = external('gai_strerror', [rffi.INT], CCHARP)
+ gai_strerror = external('gai_strerror', [rffi.INT], CCHARP,
sandboxsafe=True)
#h_errno = c_int.in_dll(socketdll, 'h_errno')
#
@@ -1333,10 +1333,10 @@
rffi.INT,
save_err=SAVE_ERR)
-FD_CLR = external_c('FD_CLR', [rffi.INT, fd_set], lltype.Void, macro=True)
-FD_ISSET = external_c('FD_ISSET', [rffi.INT, fd_set], rffi.INT, macro=True)
-FD_SET = external_c('FD_SET', [rffi.INT, fd_set], lltype.Void, macro=True)
-FD_ZERO = external_c('FD_ZERO', [fd_set], lltype.Void, macro=True)
+FD_CLR = external_c('FD_CLR', [rffi.INT, fd_set], lltype.Void, macro=True,
sandboxsafe=True)
+FD_ISSET = external_c('FD_ISSET', [rffi.INT, fd_set], rffi.INT, macro=True,
sandboxsafe=True)
+FD_SET = external_c('FD_SET', [rffi.INT, fd_set], lltype.Void, macro=True,
sandboxsafe=True)
+FD_ZERO = external_c('FD_ZERO', [fd_set], lltype.Void, macro=True,
sandboxsafe=True)
if _POSIX:
pollfdarray = rffi.CArray(pollfd)
diff --git a/rpython/rlib/rposix.py b/rpython/rlib/rposix.py
--- a/rpython/rlib/rposix.py
+++ b/rpython/rlib/rposix.py
@@ -1172,7 +1172,7 @@
return rffi.charp2str(l_name)
c_strerror = external('strerror', [rffi.INT], rffi.CCHARP,
- releasegil=False)
+ releasegil=False, sandboxsafe=True)
@replace_os_function('strerror')
def strerror(errnum):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit