Issue 9320: os.environ is global for threads (original) (raw)

Created on 2010-07-21 07:07 by techtonik, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (11)
msg111013 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-21 07:07
Seems like os.environ is shared between multiple threads. This should be documented at least in threading chapters.
msg111021 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2010-07-21 08:43
I'm not sure where you'd put this. The defining characteristic of threads is that _all_ objects are shared among them.
msg111022 - (view) Author: Konstantin Zemlyak (zart) Date: 2010-07-21 08:50
Environment variables have always been process-wide. It doesn't deserve any special mention in threads documentation.
msg111033 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-21 10:09
On Wed, Jul 21, 2010 at 11:43 AM, Eric Smith <report@bugs.python.org> wrote: > > I'm not sure where you'd put this. The defining characteristic of threads is that _all_ objects are shared among them. Where is this defining characteristic of threads is described?
msg111035 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-07-21 10:31
>> I'm not sure where you'd put this. The defining characteristic of threads is that _all_ objects are shared among them. > Where is this defining characteristic of threads is described? in http://docs.python.org/library/thread.html """...multiple threads of control sharing their global data space...""" That's how threads are understood in all programming languages.
msg111037 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-21 11:05
Closing in agreement with Eric/Amaury.
msg111100 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-21 18:35
> in http://docs.python.org/library/thread.html > """...multiple threads of control sharing their global data space...""" > > That's how threads are understood in all programming languages. Do you mean this one? """This module provides low-level primitives for working with multiple threads (also called light-weight processes or tasks) — multiple threads of control sharing their global data space.""" It is surely confusing and doesn't explain anything to people who never worked with threads (like me). It should either be split in two sentences or simplified. http://en.wikipedia.org/wiki/Thread_(computer_science) says that threads can share resources, but not necessarily do so.
msg111128 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-07-21 22:19
Quoting the wikipedia page: """multiple threads within a process share state as well as memory and other resources""" If you never worked with threads, then you really need a tutorial about threads, or even a general explanation about threads; the reference manual is not such a place. Programming with threads has really complex aspects that are not inherent to Python. [Some people will also say: if you never worked with threads, don't start]
msg111162 - (view) Author: anatoly techtonik (techtonik) Date: 2010-07-22 10:15
I have to debug CGIHTTPServer test case that apparently uses threads, and I expected to find at least some pointer about "what exactly a thread in Python is". I hope Python Manual is not only for system programmers. They do not need the manual anyway - they already know everything and there are plenty tutorials for them elsewhere. -- "please remove http://docs.python.org/ and put in a better documentation, I wasted so much time reading that bad documentation that now I hate it and I will never write code in python" (c) Mario Santamaria
msg111163 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2010-07-22 10:23
I agree with Eric, Konstantin, Amaury and Georg. Closing for the third time.
msg111165 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-22 10:37
Anatoly, I don't think it is a good idea to use signatures in tracker comments.
History
Date User Action Args
2022-04-11 14:57:04 admin set github: 53566
2010-07-22 10:37:54 georg.brandl set messages: +
2010-07-22 10:23:49 skrah set status: open -> closed
2010-07-22 10:23:28 skrah set status: pending -> opennosy: + skrahmessages: +
2010-07-22 10:15:14 techtonik set status: closed -> pendingmessages: +
2010-07-21 22:19:27 amaury.forgeotdarc set status: pending -> closedmessages: +
2010-07-21 18:35:35 techtonik set status: closed -> pendingmessages: +
2010-07-21 11:05:19 georg.brandl set status: open -> closednosy: + georg.brandlmessages: + resolution: works for me
2010-07-21 10:31:11 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2010-07-21 10:09:10 techtonik set messages: +
2010-07-21 08:50:20 zart set nosy: + zartmessages: +
2010-07-21 08:43:35 eric.smith set nosy: + eric.smithmessages: +
2010-07-21 07:07:23 techtonik create