Author: Edd Barrett <[email protected]>
Branch:
Changeset: r72117:c684bf704d1f
Date: 2014-06-20 17:32 +0100
http://bitbucket.org/pypy/pypy/changeset/c684bf704d1f/
Log: Release the GIL when calling out to fclose() and pclose()
Bug exposed by pypy bridge. Armin explains it best:
11:04 < arigato> ebarrett: that's because rpython.rlib.rfile, used
only by php, fails to translate when there are
threads involved (used only by pypy) 11:07 <
arigato> it's a limitation of rfile.py 11:07 < arigato> if it relies
on RPython __del__s to close the files, then the
files cannot be closed with the GIL released
diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -35,7 +35,7 @@
FILE = lltype.Struct('FILE') # opaque type maybe
c_open = llexternal('fopen', [rffi.CCHARP, rffi.CCHARP], lltype.Ptr(FILE))
-c_close = llexternal('fclose', [lltype.Ptr(FILE)], rffi.INT)
+c_close = llexternal('fclose', [lltype.Ptr(FILE)], rffi.INT, releasegil=False)
c_fwrite = llexternal('fwrite', [rffi.CCHARP, rffi.SIZE_T, rffi.SIZE_T,
lltype.Ptr(FILE)], rffi.SIZE_T)
c_fread = llexternal('fread', [rffi.CCHARP, rffi.SIZE_T, rffi.SIZE_T,
@@ -57,7 +57,7 @@
rffi.CCHARP)
c_popen = llexternal('popen', [rffi.CCHARP, rffi.CCHARP], lltype.Ptr(FILE))
-c_pclose = llexternal('pclose', [lltype.Ptr(FILE)], rffi.INT)
+c_pclose = llexternal('pclose', [lltype.Ptr(FILE)], rffi.INT, releasegil=False)
BASE_BUF_SIZE = 4096
BASE_LINE_SIZE = 100
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit