mirror of https://github.com/python/cpython.git
1. Correct typo in FileWrapper.close() (fix by AMK).
2. New trusted built-in modules cmath, errno, operator, parser. 3. Corrected bogus s_apply() -- the new one actually works (reported by AMK).
This commit is contained in:
parent
13bfbe77d6
commit
e7b9fde1b8
16
Lib/rexec.py
16
Lib/rexec.py
|
@ -41,7 +41,7 @@ def __init__(self, f):
|
||||||
if not hasattr(self, m):
|
if not hasattr(self, m):
|
||||||
setattr(self, m, getattr(f, m))
|
setattr(self, m, getattr(f, m))
|
||||||
|
|
||||||
def close(f):
|
def close(self):
|
||||||
self.flush()
|
self.flush()
|
||||||
|
|
||||||
|
|
||||||
|
@ -131,9 +131,10 @@ class RExec(ihooks._Verbose):
|
||||||
|
|
||||||
ok_path = tuple(sys.path) # That's a policy decision
|
ok_path = tuple(sys.path) # That's a policy decision
|
||||||
|
|
||||||
ok_builtin_modules = ('array', 'binascii', 'audioop', 'imageop',
|
ok_builtin_modules = ('audioop', 'array', 'binascii',
|
||||||
'marshal', 'math',
|
'cmath', 'errno', 'imageop',
|
||||||
'md5', 'parser', 'regex', 'rotor', 'select',
|
'marshal', 'math', 'md5', 'operator',
|
||||||
|
'parser', 'regex', 'rotor', 'select',
|
||||||
'strop', 'struct', 'time')
|
'strop', 'struct', 'time')
|
||||||
|
|
||||||
ok_posix_names = ('error', 'fstat', 'listdir', 'lstat', 'readlink',
|
ok_posix_names = ('error', 'fstat', 'listdir', 'lstat', 'readlink',
|
||||||
|
@ -320,11 +321,14 @@ def restore_files(self):
|
||||||
sys.stdout = self.save_stdout
|
sys.stdout = self.save_stdout
|
||||||
sys.stderr = self.save_stderr
|
sys.stderr = self.save_stderr
|
||||||
|
|
||||||
def s_apply(self, func, *args, **kw):
|
def s_apply(self, func, args=(), kw=None):
|
||||||
self.save_files()
|
self.save_files()
|
||||||
try:
|
try:
|
||||||
self.set_files()
|
self.set_files()
|
||||||
r = apply(func, args, kw)
|
if kw:
|
||||||
|
r = apply(func, args, kw)
|
||||||
|
else:
|
||||||
|
r = apply(func, args)
|
||||||
finally:
|
finally:
|
||||||
self.restore_files()
|
self.restore_files()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue