diff -r 5dcd7ee0716a Lib/_strptime.py --- a/Lib/_strptime.py Fri Mar 29 04:02:14 2013 +0200 +++ b/Lib/_strptime.py Fri Mar 29 12:40:02 2013 +0200 @@ -326,7 +326,7 @@ bad_directive = "%" del err raise ValueError("'%s' is a bad directive in format '%s'" % - (bad_directive, format)) + (bad_directive, format)) from None # IndexError only occurs when the format string is "%" except IndexError: raise ValueError("stray %% in format '%s'" % format) diff -r 5dcd7ee0716a Lib/test/test_time.py --- a/Lib/test/test_time.py Fri Mar 29 04:02:14 2013 +0200 +++ b/Lib/test/test_time.py Fri Mar 29 12:40:02 2013 +0200 @@ -193,6 +193,12 @@ self.assertRaises(TypeError, time.strptime, b'2009', "%Y") self.assertRaises(TypeError, time.strptime, '2009', b'%Y') + def test_strptime_exception_context(self): + try: + time.strptime("", "%D") + except ValueError as exc: + self.assertEqual(exc.__suppress_context__, True) + def test_asctime(self): time.asctime(time.gmtime(self.t))