Allow using enum elements as default values for Python functions.

Enum values are just (integer) constants in Python and so can be used as the
function default values just as well as literal numbers, account for this when
checking whether function parameters can be represented in Python.

Also rename is_primitive_defaultargs() to is_representable_as_pyargs() to
describe better what this function does.
This commit is contained in:
Vadim Zeitlin 2014-08-10 03:56:04 +02:00
commit 52bd2a1921
2 changed files with 35 additions and 31 deletions

View file

@ -1,5 +1,8 @@
import default_args
ec = default_args.EnumClass()
if not ec.blah():
raise RuntimeError,"EnumClass::blah() default arguments don't work"
if default_args.Statics_staticMethod() != 60:
raise RuntimeError