mirror of
https://github.com/micropython/micropython.git
synced 2026-05-03 06:10:14 +02:00
01a11ea45e
When calling from Python into JavaScript and passing along keyword
arguments, the FFI bindings currently only support at most 1 positional
argument. For example:
import js
js.func(1, b=2, c=3)
This commit fixes that by supporting arbitrary number of positional
arguments, in combination with keyword arguments. So now the following
works:
import js
js.func(1, 2, c=3, d=4)
Tests are added for these new, supported cases.
Signed-off-by: Damien George <damien@micropython.org>
28 lines
610 B
Plaintext
28 lines
610 B
Plaintext
undefined undefined undefined undefined undefined
|
|
1 undefined undefined undefined undefined
|
|
1 2 undefined undefined undefined
|
|
1 2 3 undefined undefined
|
|
1 2 3 4 undefined
|
|
1 2 3 4 5
|
|
1 2 3 4 5
|
|
[]
|
|
[ { a: 1 } ]
|
|
[ { a: 1, b: 2 } ]
|
|
[ { a: 1, b: 2, c: 3 } ]
|
|
[ { a: 1, b: 2, c: 3, d: 4 } ]
|
|
[ { a: 1, b: 2, c: 3, d: 4, e: 5 } ]
|
|
[ 1 ]
|
|
[ 1, { b: 2 } ]
|
|
[ 1, { b: 2, c: 3 } ]
|
|
[ 1, { b: 2, c: 3, d: 4 } ]
|
|
[ 1, { b: 2, c: 3, d: 4, e: 5 } ]
|
|
[ 1, 2 ]
|
|
[ 1, 2, { c: 3 } ]
|
|
[ 1, 2, { c: 3, d: 4 } ]
|
|
[ 1, 2, { c: 3, d: 4, e: 5 } ]
|
|
[ 1, 2, 3 ]
|
|
[ 1, 2, 3, { d: 4 } ]
|
|
[ 1, 2, 3, { d: 4, e: 5 } ]
|
|
[ 1, 2, 3, 4 ]
|
|
[ 1, 2, 3, 4, { e: 5 } ]
|