diff -r c6e529c1f87c Tools/clinic/clinic.py --- a/Tools/clinic/clinic.py Fri Jan 24 22:28:42 2014 +0200 +++ b/Tools/clinic/clinic.py Fri Jan 24 22:23:30 2014 -0600 @@ -3317,8 +3317,17 @@ bad = blacklist.bad else: # if they specify a c_default, we can be more lenient about the default value. - # but at least ensure that we can turn it into text and reconstitute it correctly. - bad = default != repr(eval(default)) + # but at least make an attempt at ensuring it's a valid expression. + bad = False + try: + value = eval(default) + if value == unspecified: + fail("'unspecified' is not a legal default value!") + except NameError: + pass # probably a named constant + except Exception as e: + fail("Malformed expression given as default value\n" + "{!r} caused {!r}".format(default, e)) if bad: fail("Unsupported expression as default value: " + repr(default))