Fred Wheeler added the comment:

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.

----------
nosy: +fredwheeler

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7980>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to