Message110705
> Does the following patch solve your issue?
I tried, but it still crashed. I could reproduce the crash by following
script. It crashed also on Python2.7, but it doesn't crash on Python3.
And when I used io.open() instead of builtin open(), it doesn't crash
even on Python2.x. (Probably because io.open implements buffer protocol
by itself)
//////////////////////////////////////////////////////
import threading
import sys
if sys.version_info.major == 3:
xrange = range
def main():
size = 1024 * 1024 # large enough
f = open("__temp__.tmp", "w", size)
for _ in xrange(size):
f.write("c")
t1 = threading.Thread(target=f.close)
t2 = threading.Thread(target=f.close)
t1.start()
t2.start()
t1.join()
t2.join()
if __name__ == '__main__':
main()
//////////////////////////////////////////////////////
I lied a bit on msg110655. close(2) is not used, that is actually
fclose(). I didn't notice the variable *close* was declared as
the parameter of fill_file_fields(). |
|
Date |
User |
Action |
Args |
2010-07-19 01:50:45 | ocean-city | set | recipients:
+ ocean-city, pitrou |
2010-07-19 01:50:44 | ocean-city | set | messageid: <1279504244.95.0.248409231195.issue9295@psf.upfronthosting.co.za> |
2010-07-19 01:50:42 | ocean-city | link | issue9295 messages |
2010-07-19 01:50:41 | ocean-city | create | |
|