[New-bugs-announce] [issue7980] time.strptime not thread safe

Willard report at bugs.python.org
Mon Feb 22 11:46:38 CET 2010


New submission from Willard <cptnwillard at gmail.com>:

The following script raises several "_strptime_time" AttributeErrors (on OS X 10.4 at least).

If time.strptime is used before starting the threads, then no exception is raised (the issue may thus come from strptime.py not being imported in a thread safe manner).


import time
import thread

def f():
    for m in xrange(1, 13):
        for d in xrange(1,29):
            time.strptime("2010%02d%02d"%(m,d),"%Y%m%d")

for _ in xrange(10):
    thread.start_new_thread(f, ())
time.sleep(3)


> Traceback (most recent call last):
>   File "[...]/test.py", line 75, in f
>     time.strptime("2010%02d%02d"%(m,d),"%Y%m%d")
> AttributeError: _strptime_time

----------
components: Library (Lib)
messages: 99718
nosy: cptnwillard
severity: normal
status: open
title: time.strptime not thread safe
type: crash
versions: Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7980>
_______________________________________


More information about the New-bugs-announce mailing list