This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients brett.cannon, docs@python, eric.snow, ezio.melotti, joshpurvis, ncoghlan, r.david.murray, vstinner
Date 2016-06-26.20:54:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1466974447.19.0.856768238866.issue27387@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-06-26 20:54:07r.david.murraysetrecipients: + r.david.murray, brett.cannon, ncoghlan, vstinner, ezio.melotti, docs@python, eric.snow, joshpurvis
2016-06-26 20:54:07r.david.murraysetmessageid: <1466974447.19.0.856768238866.issue27387@psf.upfronthosting.co.za>
2016-06-26 20:54:07r.david.murraylinkissue27387 messages
2016-06-26 20:54:06r.david.murraycreate