← index #14376Issue #14388
Off-topic · high · value 0.859
QUERY · ISSUE

Assignment expression raises error if updating global variable

openby rkompassopened 2024-04-25updated 2024-04-25
bug

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.

CANDIDATE · ISSUE

ValueError: SPI(0) doesn't exist on Nucleo F767ZI

closedby luca827opened 2024-04-28updated 2024-09-02
port-stm32

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.

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