mirror of
https://github.com/python/cpython.git
synced 2025-11-20 10:57:44 +00:00
Document import ./. threading issues. #1720705.
This commit is contained in:
parent
ebcfd11c16
commit
f1699cd4c1
2 changed files with 12 additions and 1 deletions
|
|
@ -150,6 +150,11 @@ In addition to these methods, lock objects can also be used via the
|
||||||
exception will be received by an arbitrary thread. (When the :mod:`signal`
|
exception will be received by an arbitrary thread. (When the :mod:`signal`
|
||||||
module is available, interrupts always go to the main thread.)
|
module is available, interrupts always go to the main thread.)
|
||||||
|
|
||||||
|
* The import machinery is not thread safe. In general, an import may not
|
||||||
|
have the side effect of importing a module, and only the main thread
|
||||||
|
should import modules. Imports within or caused by a thread other than
|
||||||
|
the main thread isn't safe.
|
||||||
|
|
||||||
* Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is
|
* Calling :func:`sys.exit` or raising the :exc:`SystemExit` exception is
|
||||||
equivalent to calling :func:`exit`.
|
equivalent to calling :func:`exit`.
|
||||||
|
|
||||||
|
|
@ -170,4 +175,3 @@ In addition to these methods, lock objects can also be used via the
|
||||||
* When the main thread exits, it does not do any of its usual cleanup (except
|
* When the main thread exits, it does not do any of its usual cleanup (except
|
||||||
that :keyword:`try` ... :keyword:`finally` clauses are honored), and the
|
that :keyword:`try` ... :keyword:`finally` clauses are honored), and the
|
||||||
standard I/O files are not flushed.
|
standard I/O files are not flushed.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -562,6 +562,13 @@ the :meth:`setDaemon` method and retrieved with the :meth:`isDaemon` method.
|
||||||
There is a "main thread" object; this corresponds to the initial thread of
|
There is a "main thread" object; this corresponds to the initial thread of
|
||||||
control in the Python program. It is not a daemon thread.
|
control in the Python program. It is not a daemon thread.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
The import machinery is not thread safe. In general, an import may not
|
||||||
|
have the side effect of importing a module, and only the main thread
|
||||||
|
should import modules. Imports within or caused by a thread other than
|
||||||
|
the main thread isn't safe.
|
||||||
|
|
||||||
There is the possibility that "dummy thread objects" are created. These are
|
There is the possibility that "dummy thread objects" are created. These are
|
||||||
thread objects corresponding to "alien threads", which are threads of control
|
thread objects corresponding to "alien threads", which are threads of control
|
||||||
started outside the threading module, such as directly from C code. Dummy
|
started outside the threading module, such as directly from C code. Dummy
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue