[pypy-commit] pypy py3k: graft eb88834f82b2
arigo
pypy.commits at gmail.com
Tue Sep 13 13:11:47 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: py3k
Changeset: r87088:10c68ca3af89
Date: 2016-09-13 19:11 +0200
http://bitbucket.org/pypy/pypy/changeset/10c68ca3af89/
Log: graft eb88834f82b2
diff --git a/pypy/module/posix/__init__.py b/pypy/module/posix/__init__.py
--- a/pypy/module/posix/__init__.py
+++ b/pypy/module/posix/__init__.py
@@ -193,6 +193,9 @@
interpleveldefs['_have_functions'] = (
'space.newlist([space.wrap(x) for x in interp_posix.have_functions])')
+ if not rposix._WIN32:
+ interpleveldefs['sync'] = 'interp_posix.sync'
+
def startup(self, space):
from pypy.module.posix import interp_posix
interp_posix.get(space).startup(space)
diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -342,6 +342,10 @@
except OSError as e:
raise wrap_oserror(space, e)
+def sync(space):
+ """Force write of everything to disk."""
+ rposix.sync()
+
def fchdir(space, w_fd):
"""Change to the directory of the given file descriptor. fildes must be
opened on a directory, not a file."""
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1079,6 +1079,10 @@
x = f.read(1)
assert x == 'e'
+ if sys.platform != 'win32':
+ def test_sync(self):
+ self.posix.sync() # does not raise
+
def test_urandom(self):
os = self.posix
s = os.urandom(5)
More information about the pypy-commit
mailing list