Commit fbf400b5 authored by Alex Henrie's avatar Alex Henrie Committed by GitHub

Mark missing argument errors in argument parsing code as unlikely (GH-3428)

parent 606b4f44
...@@ -3790,14 +3790,14 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3790,14 +3790,14 @@ class DefNodeWrapper(FuncDefNode):
compare = '!=' compare = '!='
else: else:
compare = '<' compare = '<'
code.putln('} else if (%s %s %d) {' % ( code.putln('} else if (unlikely(%s %s %d)) {' % (
Naming.nargs_cname, compare, min_positional_args)) Naming.nargs_cname, compare, min_positional_args))
code.put_goto(argtuple_error_label) code.put_goto(argtuple_error_label)
if self.num_required_kw_args: if self.num_required_kw_args:
# pure error case: keywords required but not passed # pure error case: keywords required but not passed
if max_positional_args > min_positional_args and not self.star_arg: if max_positional_args > min_positional_args and not self.star_arg:
code.putln('} else if (%s > %d) {' % ( code.putln('} else if (unlikely(%s > %d)) {' % (
Naming.nargs_cname, max_positional_args)) Naming.nargs_cname, max_positional_args))
code.put_goto(argtuple_error_label) code.put_goto(argtuple_error_label)
code.putln('} else {') code.putln('} else {')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment