← index #11736Issue #328
Related · high · value 0.891
QUERY · ISSUE

'/' as a parameter of a function gives a syntax error

openby xiaxinmengopened 2023-06-08updated 2023-06-08
bug

If a python program takes / as the parameter of a function, micropython reports a SyntaxError. See the following case. This test case can work normally on CPython.

MicroPython_exampe.py

def run_in_thread(func, /, *args, **kwargs):
    pass

The expected behavior:

CPython 3.9.0: work normally

The actual output:

Traceback (most recent call last):
  File "/home/xxm/Desktop/MicroPython_exampe.py", line 55
SyntaxError: invalid syntax

Test Environment:

Unix port,
MicroPython v1.20.0-162-gd080d427e on 2023-06-08; linux [GCC 7.5.0] version
Ubuntu 18.04
CPython 3.9.0

CANDIDATE · ISSUE

function define syntax check

closedby deepgullyopened 2014-02-27updated 2014-03-03
def foo(a, b=3, c):
    print(a, b, c)

it's a syntax error in CPython: non-default argument follows default argument

can be compiled success in MP and run wrongly

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied