Assignment expression raises error if updating global variable
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
w600, RP2, others
MicroPython version
MicroPython v1.23.0-preview.362.g3995158d9.dirty on 2024-04-19
Reproduction
a=0; print([(a:=a+1) for b in range(10)])
Expected behaviour
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Observed behaviour
SyntaxError: identifier redefined as global
Additional Information
I saw the discussion on https://github.com/micropython/micropython/pull/4908
but there it is about a variable created in the comprehension context being available as global outside.
Here is a variable already present as global.
micropython crashes with `print(">>> ", end='')` expression after roughly 0.02 seconds
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
rp2
MicroPython version
MicroPython v1.22.2 on 2024-02-22; Raspberry Pi Pico with RP2040
Reproduction
import time
print('>>> ',end='')
while True:
time.sleep(0.02)
print("THIS SHOULD BE PRINTED!")
Expected behaviour
">>> " string without new line printed on shell
Observed behaviour
For some unknown reason, I can't print exactly what I want, which should be ">>> " without new line escape sequence (\n).
A workaround is to print ">>> \b" (three greater-than signs followed by two spaces and a backspace escape sequence (\b)).
To avoid crashes you need to print something after the print('>>> ',end='') in a time span of roughly less than 0.02 seconds, but as I said before, that is not the goal, i want to print exactly ">>> " without newline or any aditional characters, which I consider to be a bug.
Additional Information
No, I've provided everything above.