$ cat lib.py
def fn() -> tuple[int, int]:
i = 0
return (i, (i := i + 1))
$ python -c 'from lib import fn; print(fn())'
(0, 1)
$ mypyc lib.py
running build_ext
building 'lib' extension
...
$ python -c 'from lib import fn; print(fn())'
(1, 1)
Notice the first element of the tuple becomes 1 instead of 0 with mypyc compiled code.
Tested on a Linux machine with Python 3.14 and mypy 1.19.1.
Notice the first element of the tuple becomes
1instead of0with mypyc compiled code.Tested on a Linux machine with Python 3.14 and mypy 1.19.1.