reloadium icon indicating copy to clipboard operation
reloadium copied to clipboard

Question about Decorators

Open nzl-thu opened this issue 2 years ago • 3 comments

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: image

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

nzl-thu avatar Jul 01 '22 11:07 nzl-thu

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.

dkrystki avatar Jul 01 '22 11:07 dkrystki

Thanks for your reply!

nzl-thu avatar Jul 02 '22 06:07 nzl-thu

@nzl-thu I'm currently working on this. Could you describe your exact use case? Just want to make sure my solution covers it.

dkrystki avatar Aug 09 '22 12:08 dkrystki

Added in reloadium 0.9.2 (PyCharm plugin 0.8.5)

dkrystki avatar Sep 05 '22 15:09 dkrystki