Skip to content

Commit e8efe61

Browse files
committed
Add thread-safety warning to os.environ docs
1 parent 423ae0f commit e8efe61

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/library/os.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@ process and user.
214214
cause memory leaks. Refer to the system documentation for
215215
:c:func:`!putenv`.
216216

217+
.. warning::
218+
Setting or unsetting environment variables from one thread while
219+
another thread reads or writes them is not guaranteed to be
220+
thread-safe and can crash the process on some platforms.
221+
217222
You can delete items in this mapping to unset environment variables.
218223
:func:`unsetenv` will be called automatically when an item is deleted from
219224
:data:`os.environ`, and when one of the :meth:`~dict.pop` or

0 commit comments

Comments
 (0)