I have this code:
import ctypes
import inspect
def fun():
c = 3
inspect.currentframe().f_locals['c'] = 4
ctypes.pythonapi.PyFrame_LocalsToFast(ctypes.py_object(inspect.currentframe()), ctypes.c_int(0))
print(c)
fun()
If you "Run", the output will be:
>>> 4
But with "Debug" and a breakpoint on "print(c)".
By calling "print(c)" to the console, the output will be like this:
>>> 3
Why different behavior? And can this be fixed?
Work with PyDev console pycharm
In my case it works like this: