diff -r 3d9e35137641 Lib/ctypes/test/test_values.py --- a/Lib/ctypes/test/test_values.py Fri Jun 20 23:00:22 2014 +0100 +++ b/Lib/ctypes/test/test_values.py Mon Jun 23 15:20:51 2014 +0300 @@ -4,6 +4,7 @@ import unittest import sys +from textwrap import dedent from ctypes import * import _ctypes_test @@ -43,10 +44,18 @@ opt = c_int.in_dll(pythonapi, "Py_OptimizeFlag").value if __debug__: self.assertEqual(opt, 0) - elif ValuesTestCase.__doc__ is not None: - self.assertEqual(opt, 1) else: - self.assertEqual(opt, 2) + locals_, globals_ = {}, {} + exec(dedent(""" + class A: + ''' docstring ''' + """), globals_, locals_) + docstring = locals_['A'].__doc__ + if docstring: + self.assertEqual(opt, 1) + else: + self.assertEqual(opt, 2) + def test_frozentable(self): # Python exports a PyImport_FrozenModules symbol. This is a