[issue32902] FileInput "inplace" redirects output of other threads

2020-10-20 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32902] FileInput "inplace" redirects output of other threads

2020-10-05 Thread Irit Katriel


Irit Katriel  added the comment:

In general, stackoverflow is a better place for questions like this - you are 
likely to get a quicker response there.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32902] FileInput "inplace" redirects output of other threads

2020-10-05 Thread Irit Katriel


Irit Katriel  added the comment:

stdout is indeed shared between all threads, and it is also not guaranteed to 
be thread safe, so if two threads write to it simultaneously that can cause 
problems.

It is better to have one thread in you program writing to stdout, with 
thread-safe communication channels from other threads to this one.

Alternatively, you can create different processes instead of threads, and then 
each process will have its own stdout and redirecting one will not impact the 
others.

--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue32902] FileInput "inplace" redirects output of other threads

2018-02-21 Thread mj4int

New submission from mj4int :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com