Author fredwheeler
Recipients Romuald, William.McBrine, amaury.forgeotdarc, belopolsky, brett.cannon, ccorbacho, ced, cptnwillard, davidfraser, dpalms2011, epu, eric.smith, flox, fredwheeler, kzsolt, mark.dickinson, matrixise, pitrou, r.david.murray, ruseel
Date 2014-06-20.15:03:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1403276584.17.0.259276890143.issue7980@psf.upfronthosting.co.za>
In-reply-to
Content
This issue should be noted in the documentation of strptime in the time and datetime modules and/or the thread module.  As it stands there is no good way for a user of these modules to learn of this problem until one day the right race conditions exist to expose the problem.


Perhaps the following notes will do?

https://docs.python.org/2/library/time.html#time.strptime

Thread safety: The use of strptime is thread safe, but with one important caveat.  The first use of strptime is not thread safe because the first use will import _strptime.  That import is not thread safe and may throw AttributeError or ImportError.  To avoid this issue, import _strptime explicitly before starting threads, or call strptime once before starting threads.

https://docs.python.org/2/library/datetime.html
(under strptime())

See time.strptime() for important thread safety information.


Having just encountered this unusual and undocumented thread safety problem using 2.7.6, I'm wondering if there are other similar lurking thread safety issues that I might only find when the race conditions are just right and my program stops working.
History
Date User Action Args
2014-06-20 15:03:04fredwheelersetrecipients: + fredwheeler, brett.cannon, amaury.forgeotdarc, mark.dickinson, davidfraser, belopolsky, pitrou, eric.smith, ruseel, cptnwillard, ced, r.david.murray, flox, ccorbacho, kzsolt, matrixise, William.McBrine, epu, dpalms2011, Romuald
2014-06-20 15:03:04fredwheelersetmessageid: <1403276584.17.0.259276890143.issue7980@psf.upfronthosting.co.za>
2014-06-20 15:03:04fredwheelerlinkissue7980 messages
2014-06-20 15:03:03fredwheelercreate