Skip to content

Commit

Permalink
Handle better incorrect number of arguments being passed to a procedure
Browse files Browse the repository at this point in the history
Closes #54
  • Loading branch information
rjfarmer committed Feb 27, 2024
1 parent 59b8b71 commit 45efbd7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions gfort2py/fProc.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ def args_start(self):
def args_check(self, *args, **kwargs):
count = 0
arguments = []

if len(args) + len(kwargs) < len(self.obj.args()):
raise TypeError("Not enough arguments passed")
elif len(args) + len(kwargs) > len(self.obj.args()):
raise TypeError("too many arguments passed")

# Build list of inputs
for fval in self.obj.args():
if self._allobjs[fval.ref].is_procedure():
Expand Down

0 comments on commit 45efbd7

Please sign in to comment.