This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author loewis
Recipients amaury.forgeotdarc, benjamin.peterson, loewis, pitrou
Date 2008-08-01.21:51:01
SpamBayes Score 0.0005357643
Marked as misclassified No
Message-id <[email protected]>
In-reply-to <[email protected]>
Content
> I should have precised that in the context of this issue, "thread-safe" does not
> mean "produces perfectly correct output" but simply "does not raise exceptions
> when using the same buffered object from two different threads".

In that case, I'm -1 for this patch. Raising exceptions is much more
preferable to silently losing data, or writing garbage.

> The former would be preferable but is not required, IMHO, for a buffered IO library; the
> latter is much more critical because as Amaury points out, you otherwise get
> exceptions when printing e.g. debut output from multiple threads.

And that's a good thing, when using a library that is not thread-safe.

Either the library provides thread-safety, or it doesn't. If it doesn't,
it's the application's responsibility to not use the library from
multiple threads, or protect all access with appropriate
synchronization. Now that print is a function, it's easy to implement
a version of it that synchronizes all prints.

With the status quo, people have at least a chance of learning that the
library is not thread-safe. If the shallow problems are resolved, people
will cry FOUL loudly when they learn about the deep problems.
History
Date User Action Args
2008-08-01 21:51:03loewissetrecipients: + loewis, amaury.forgeotdarc, pitrou, benjamin.peterson
2008-08-01 21:51:02loewislinkissue3476 messages
2008-08-01 21:51:01loewiscreate