Commit c824a382 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix #1767

parent 866c3e8a
...@@ -3621,10 +3621,12 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3621,10 +3621,12 @@ class DefNodeWrapper(FuncDefNode):
reversed_args = list(enumerate(positional_args))[::-1] reversed_args = list(enumerate(positional_args))[::-1]
for i, arg in reversed_args: for i, arg in reversed_args:
if i >= min_positional_args-1: if i >= min_positional_args-1:
if i != reversed_args[0][0]:
code.putln('CYTHON_FALLTHROUGH;')
code.put('case %2d: ' % (i+1)) code.put('case %2d: ' % (i+1))
code.putln("values[%d] = PyTuple_GET_ITEM(%s, %d);" % (i, Naming.args_cname, i)) code.putln("values[%d] = PyTuple_GET_ITEM(%s, %d);" % (i, Naming.args_cname, i))
code.putln('CYTHON_FALLTHROUGH;')
if min_positional_args == 0: if min_positional_args == 0:
code.putln('CYTHON_FALLTHROUGH;')
code.put('case 0: ') code.put('case 0: ')
code.putln('break;') code.putln('break;')
if self.star_arg: if self.star_arg:
...@@ -3781,6 +3783,8 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3781,6 +3783,8 @@ class DefNodeWrapper(FuncDefNode):
if self.star_arg and i == max_positional_args: if self.star_arg and i == max_positional_args:
code.putln('default:') code.putln('default:')
else: else:
if i != 0:
code.putln('CYTHON_FALLTHROUGH;')
code.putln('case %2d:' % i) code.putln('case %2d:' % i)
pystring_cname = code.intern_identifier(arg.name) pystring_cname = code.intern_identifier(arg.name)
if arg.default: if arg.default:
...@@ -3819,8 +3823,6 @@ class DefNodeWrapper(FuncDefNode): ...@@ -3819,8 +3823,6 @@ class DefNodeWrapper(FuncDefNode):
self.name, pystring_cname)) self.name, pystring_cname))
code.putln(code.error_goto(self.pos)) code.putln(code.error_goto(self.pos))
code.putln('}') code.putln('}')
if max_positional_args > 0 and i < last_required_arg:
code.putln('CYTHON_FALLTHROUGH;')
if max_positional_args > 0: if max_positional_args > 0:
code.putln('}') code.putln('}')
......
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