Thread-safe equivalent to python's time.strptime()? Thread-safe equivalent to python's time.strptime()? python python

Thread-safe equivalent to python's time.strptime()?


According to the bug report, this doesn't happen if you call strptime once before creating your threads. I've done a little testing which seems to confirm this. So just make any call to strptime during initialization as a workaround.


Just another workaround for this bug, you can simply import _strptime manually, along with datetime

import _strptimefrom datetime import datetime# then, in threaded blockdatetime.strptime(date, format)


Have you tried manually synchronizing it yourself? Possibly using the synchronization decorator from this recipe.