Files
micropython/tests/cpydiff/core_function_star.py
T
Jeff Epler 5ddc551bc4 py/compile: Reject *arg after keyword argument.
Document this in cpydiff and add a test with expected output
for coverage testing.

As discussed in #11441, the code growth from handling this
case seems to outweigh the benefit of implementing it
properly.

Closes: #11439

Signed-off-by: Jeff Epler <jepler@unpythonic.net>
2026-04-15 15:40:15 +10:00

17 lines
372 B
Python

"""
categories: Core,Functions
description: ``*args`` cannot follow a keyword argument
cause: MicroPython is optimised for code space. For more information see `this issue <https://github.com/micropython/micropython/issues/11439>`_.
workaround: Re-order the arguments
"""
def f(x, y):
return x + y
try:
print(f(y=1, *(3,)))
except Exception as e:
print(e)