New submission from Benjamin Fogle <[email protected]>:
To reproduce:
```
import threading
import io
import time
import _pyio
class MyFileIO(io.FileIO):
def flush(self):
# Simulate a slow flush. Slow disk, etc.
time.sleep(0.25)
super().flush()
raw = MyFileIO('test.dat', 'wb')
#fp = _pyio.BufferedWriter(raw)
fp = io.BufferedWriter(raw)
t1 = threading.Thread(target=fp.close)
t1.start()
time.sleep(0.1) # Ensure t1 is sleeping in fp.close()/raw.flush()
fp.write(b'test')
t1.join()
```
_pyio.BufferedWriter ignores the error completely rather than throwing a
ValueError("write to closed file").
----------
components: Interpreter Core
messages: 305803
nosy: benfogle
priority: normal
severity: normal
status: open
title: Segfault when closing BufferedWriter from a different thread
versions: Python 3.6, Python 3.7
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31976>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com