[New-bugs-announce] [issue32902] FileInput "inplace" redirects output of other threads

mj4int report at bugs.python.org
Wed Feb 21 19:01:28 EST 2018


New submission from mj4int <michael.johnson at intel.com>:

A pool of threads exists, all of which have started executing.

Thread A has a fileinput object and is currently iterating over the files in "edit in place mode".  For each file, stdout is redirected to the file.  Thread A can call print and write to the file.

Thread B just wants to log some things in the console.  Thread B calls print and... writes to the file thread A is processing.  stdout is hijacked by thread A's fileinput loop.

Whether or not every thread should have an independent evaluation of stdout, certainly a fileinput object shouldn't silently redirect the prints of an innocent bystander thread?

May exist in other python versions, but not checked.

----------
components: IO, Library (Lib)
messages: 312516
nosy: mj4int
priority: normal
severity: normal
status: open
title: FileInput "inplace" redirects output of other threads
type: behavior
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32902>
_______________________________________


More information about the New-bugs-announce mailing list