Robert Collins wrote:
> Looks like a race condition on startup I think - is lazy_import
> threadsafe?
I doubt it. Certainly I don't think any effort has gone into trying to
make it threadsafe, so it's safest to assume not.
(Then again, I don't think you can say that import in general is
thread-safe either, it depends on what code is run at import time.
Python guarantees that the import machinery is threadsafe[1]… but
obviously it can't make guarantees about code run within that machinery,
and people do all sorts of strange things at import time.)
Robert Collins wrote:
> Looks like a race condition on startup I think - is lazy_import
> threadsafe?
I doubt it. Certainly I don't think any effort has gone into trying to
make it threadsafe, so it's safest to assume not.
(Then again, I don't think you can say that import in general is
thread-safe either, it depends on what code is run at import time.
Python guarantees that the import machinery is threadsafe[1]… but
obviously it can't make guarantees about code run within that machinery,
and people do all sorts of strange things at import time.)
-Andrew.
[1] with two caveats: 1. imports shouldn't spawn threads and then wait docs.python. org/library/ threading. html#importing- in-threaded- code>
on them, 2. imports must be completed before interpreter shutdown
starts.
<http://