gregory p smith amuhkryptoorg ive reviewed patch httpbugspythonorgissue815646 uploaded modified version mostly test improvements formatting keep c code 80 columns proper 8 space tabs would committed already sneaking suspicion unit test barf windows since could depend posixlike file system semantics could someone windows build environment please test asked issue report back tracker thanks gps wed apr 2 2008 1147 guido van rossum wrote wed apr 2 2008 317 antoine pitrou wrote guido van rossum pythonorg writes solution counter seems fine except think perhaps close call raise ioerror instead set flag thread makes counter go zero close thread file got closed used agree gregory explicit happens wonder would gain approach apart encouraging dangerous coding practices also depends far want go merely proposing fix crashes want provide smarter close variation suggest people want need take risk also agree gregory least issue fclose think nonclosing operations fine given posix requirement streams internal lock multiple threads reading file sounds insane multiple files writing file pretty common think stdout stderr supported course concurrency issues besides close two threads try io file c stdio library case stdio files threadsafe c level according glibc documentation httpwwwgnuorgsoftwarelibcmanualhtml_nodestreamsandthreadshtml posix standard requires default stream operations atomic ie issuing two stream operations stream two threads time cause operations executed issued sequentially buffer operations performed reading writing protected uses stream stream internal lock object implicitly acquired work done according posix rules perfectly safe cool case someone would try patch windows os x see test_filepy passes without crashing know windows internal locks stdio trust osx bsd descendant posix compliant im worried 1 patch assuming developer reviews submits thu 07 aug 2008 021724 0700 pythondev threadsafe file objects return