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.
ValueError: SPI(0) doesn't exist on Nucleo F767ZI
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
Nucleo F767ZI
MicroPython version
MicroPython v1.22.2
Reproduction
from machine import SPI
spi = SPI(0, sck='D13', miso='D12', mosi='D11')
Expected behaviour
No response
Observed behaviour
Traceback (most recent call last):
File "<stdin>", line 3, in <module>
ValueError: SPI(0) doesn't exist
Additional Information
No, I've provided everything above.