Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions autowrap/CodeGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,8 @@ def _create_overloaded_method_decl(
method_code.add(
""" else:
| raise
+ Exception('can not handle type of %s' % (args,))"""
+ Exception('can not handle types %s as arguments for function %s()' % (tuple(type(arg).__name__ for arg in args), '$py_name'))""",
locals(),
)
return method_code, typestub_code

Expand Down Expand Up @@ -1126,7 +1127,7 @@ def _create_fun_decl_and_input_conversion(self, code, py_name, method, is_free_f
cleanups.append(cleanup)
call_args.append(call_as)
in_types.append(t)
checks.append((n, converter.type_check_expression(t, n)))
checks.append((n, converter.type_check_expression(t, n), py_typing_type))

# Step 1: create method decl statement
if not is_free_fun and not method.is_static:
Expand Down Expand Up @@ -1204,8 +1205,8 @@ def _create_fun_decl_and_input_conversion(self, code, py_name, method, is_free_f

# Step 2a: create code which converts python input args to c++ args of
# wrapped method
for n, check in checks:
code.add(" assert %s, 'arg %s wrong type'" % (check, n))
for n, check, expected_type in checks:
code.add(" assert %s, 'arg %s wrong type (expected %s)'" % (check, n, expected_type))
# Step 2b: add any more sophisticated conversion code that was created
# above:
for conv_code in input_conversion_codes:
Expand Down