reloadium
reloadium copied to clipboard
Question about Decorators
Describe the bug The decorators seem not working properly, so I'm wondering if I'm missing out something here. When I add a comment like "# reloadium: no_reload", it does not prevent reloadium from reloading the code.
To Reproduce Here is a simple python file:
print(3) # reloadium: no_reload
print(4)
And toggle a breakpoint in the second line in PyCharm app(Mac). Run "Debug with Reloadium", the pycharm debugger stops at the second line.
Expected behavior
When changing the first line into print(5) # reloadium: no_reload
, it should not reload this line. So when pressing "cmd+S", the python debug console should not print anything.
Screenshots
However, reloadium seems to ignore the comment and still reloaded the first line of code. So the python debug console print 5:
Desktop (please complete the following information):
- OS: MacOS Monterey
- OS version: 12.1
- Reloadium package version: 0.8.3
- PyCharm plugin version: 2021.2
- Editor: PyCharm
- Run mode: Debug
Thanks for submitting this.
Decorators are not supported when reloading frames (function or module ones) yet.
Reloading frames is performed by restarting frame from the top so ignoring code here is a little bit more tricky since it can't be just simply removed from the ast before re-executing (will cause undefined variables) . It can be done though and will be supported in the future.
Thanks for your reply!
@nzl-thu I'm currently working on this. Could you describe your exact use case? Just want to make sure my solution covers it.
Added in reloadium 0.9.2 (PyCharm plugin 0.8.5)