Zachary Ware added the comment:

This will still cause issue in _sre.c; repr(sys.maxsize) == 
'9223372036854775807' != 'sys.maxsize'.

Yes, it's bad form to throw the net too wide, but for anything other than 
NameError, we fail out in the next block anyway.  My (second) patch just makes 
for nicer output from the failure, though it does fail to say what the 
exception was.

What about something more along these lines?

bad = False
try:
    eval(default)
except NameError:
    pass # probably a named constant
except Exception as e:
    fail("Malformed expression given as default value\n"
         "{!r} raised {!r}".format(default, e))

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20381>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to