From ba5c31bfba8a03bd6e9bedbfab90f2f17154504e 2014-03-03 02:09:00 From: MinRK Date: 2014-03-03 02:09:00 Subject: [PATCH] make one strptime call at import of jsonutil avoids thread safety issues (Python bug #7980) --- diff --git a/IPython/utils/jsonutil.py b/IPython/utils/jsonutil.py index 68630be..b16f14d 100644 --- a/IPython/utils/jsonutil.py +++ b/IPython/utils/jsonutil.py @@ -36,6 +36,10 @@ next_attr_name = '__next__' if py3compat.PY3 else 'next' ISO8601 = "%Y-%m-%dT%H:%M:%S.%f" ISO8601_PAT=re.compile(r"^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})(\.\d{1,6})?Z?([\+\-]\d{2}:?\d{2})?$") +# holy crap, strptime is not threadsafe. +# Calling it once at import seems to help. +datetime.strptime("1", "%d") + #----------------------------------------------------------------------------- # Classes and functions #-----------------------------------------------------------------------------