[docs] [issue27387] Thread hangs on str.encode() when locale is not set

R. David Murray report at bugs.python.org
Sun Jun 26 16:54:07 EDT 2016

R. David Murray added the comment:

This situation is warned about explicitly in the threading docs (https://docs.python.org/2/library/threading.html#importing-in-threaded-code).  The import deadlock is fixed in python3, but it is still a really bad idea to launch threads on module import.

What isn't obvious, of course, is that calling encode for the first time for a given encoding does an implicit import of the relevant encoding.  I don't think encodings is the only stdlib module that does implicit imports, but it is probably the most used case.  Maybe it is worth adding a warning to that section of the 2.7 docs about implicit imports in general and encode/decode in particular?

assignee:  -> docs at python
components: +Documentation -Interpreter Core, Unicode
nosy: +docs at python, r.david.murray

Python tracker <report at bugs.python.org>

More information about the docs mailing list