[issue19050] crash while writing to a closed file descriptor
Zachary Ware added the comment: Still an issue in 2.7.10rc0+. Here's a couple different reproducers that come closer to the heart of the matter: import os [43913 refs] os.close(1) [43913 refs] input() 1 [43915 refs] crash import os [43913 refs] f = file('test', 'wb') [43921 refs] os.close(f.fileno()) [43921 refs] f.flush() [43921 refs] f.write('test') [43921 refs] f.flush() crash The problem appears to be calling fflush on a pointer to a closed file. In the first reproducer, this happens in myreadline.c, the second in fileobject.c. I was interested enough to track it down; I'm not motivated enough to fix it since it appears to be broken only in 2.7. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Zachary Ware added the comment: On sudden inspiration, here's an even simpler reproducer: import os [43913 refs] os.close(2) crash -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Changes by Brian Curtin br...@python.org: -- nosy: -brian.curtin ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
STINNER Victor added the comment: I'm sorry, I can't try this myself as I no longer run 2.7. You should install Python 2.7 if you want to work on Python 2.7 only issue. It's not so hard to install Python, especially on Windows (this issue looks to be specific to Windows). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Mark Lawrence added the comment: Is this still an issue with later versions of 2.7? I'm sorry, I can't try this myself as I no longer run 2.7. -- nosy: +BreamoreBoy, steve.dower, zach.ware ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Tim Golden added the comment: I can confirm that 2.7.2 hard-crashes as described on Windows. I'm not sure if I have the wherewithal to build 2.7 on this laptop to see if it's fixed in tip. 3.3 simply raises an IOError. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- priority: normal - high ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Tim Peters added the comment: Here with 2.7.5 on Windows (Vista): C:\Python27python.exe Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Type help, copyright, credits or license for more information. import io, sys fd = io.open(sys.stdout.fileno(), 'wb') fd.close() sys.stdout.write(now writing on stdout will cause a crash) At this point Windows pops up a box saying python.exe has stopped working. I don't have a debug build available, and all I can find out is that it's a memory error in this line, somewhere in MS's C libraries: and dword ptr ds:[718DD7A0h],0 So, ya, it's a crash ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Antoine Pitrou added the comment: I don't get a crash under Linux. Perhaps this is a Windows-specific thing. -- components: +Interpreter Core, Windows -Library (Lib) nosy: +brian.curtin, pitrou, tim.golden, tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
New submission from Daniel Rohlfing: This snippet let my interpreter crash immediately: import sys, io io.open(sys.stdout.fileno(), 'wb') fd.close() sys.stdout.write(now writing on stdout will cause a crash) That's happened on Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32 Windows 7 SP1 x64 The same code let Python 3.3.2 throw an exception like this: Exception OSError: OSError(9, 'Bad file descriptor') in _io.TextIOWrapper name='stdout' mode='w' encoding='cp850' ignored -- components: Library (Lib) messages: 198063 nosy: damiro priority: normal severity: normal status: open title: crash while writing to a closed file descriptor type: crash versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue19050] crash while writing to a closed file descriptor
Daniel Rohlfing added the comment: the correct snippet is: fd = io.open(sys.stdout.fileno(), 'wb') fd.close() sys.stdout.write(now writing on stdout will cause a crash) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19050 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com