Author: Brian Kearns <[email protected]>
Branch: use-file-star-for-file
Changeset: r73435:99c40ef45b66
Date: 2014-09-10 20:22 -0400
http://bitbucket.org/pypy/pypy/changeset/99c40ef45b66/
Log: merge default
diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -205,7 +205,7 @@
def create_stdio():
- close2 = [None, None]
+ close2 = (None, None)
stdin = RFile(c_stdin(), close2=close2)
stdout = RFile(c_stdout(), close2=close2)
stderr = RFile(c_stderr(), close2=close2)
diff --git a/rpython/translator/sandbox/rsandbox.py
b/rpython/translator/sandbox/rsandbox.py
--- a/rpython/translator/sandbox/rsandbox.py
+++ b/rpython/translator/sandbox/rsandbox.py
@@ -61,13 +61,16 @@
def need_more_data(self):
buflen = self.buflen
buf = lltype.malloc(rffi.CCHARP.TO, buflen, flavor='raw')
- buflen = rffi.cast(rffi.SIZE_T, buflen)
- count = ll_read_not_sandboxed(self.fd, buf, buflen)
- count = rffi.cast(lltype.Signed, count)
- if count <= 0:
- raise IOError
- self.buf += ''.join([buf[i] for i in range(count)])
- self.buflen *= 2
+ try:
+ buflen = rffi.cast(rffi.SIZE_T, buflen)
+ count = ll_read_not_sandboxed(self.fd, buf, buflen)
+ count = rffi.cast(lltype.Signed, count)
+ if count <= 0:
+ raise IOError
+ self.buf += ''.join([buf[i] for i in range(count)])
+ self.buflen *= 2
+ finally:
+ lltype.free(buf, flavor='raw')
def sandboxed_io(buf):
STDIN = 0
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit