Author fabioz
Recipients Mark.Shannon, brett.cannon, dino.viehland, eric.snow, fabioz, vstinner
Date 2019-11-21.17:01:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>

First you have to explain to me how you envision changing the method code reliably in the debugger... 

Import hooks don't work (they'd break with something as simple as the code below)

def method():
   a = 10

mod = reload(old_mod)
old_mod.method.__code__ = mod.method.__code__

using the tracing also doesn't work (it's too late to change the code)

Note: consider the reload just an example, not the only use case (say, the user could pickle code objects to remote execution and the debugger should still work).

Also, consider you have to change the bytecode of methods which are only internal to a function (and thus can't be accessed from the outside).

Then, if you have a reliable way to do it, how do you keep track of those code objects to reapply the patching when breakpoints change? What if it adds a breakpoint to a new method, how do you locate it? Creating strong references to methods isn't an option because it would prevent things from being garbage collected (and you'd have to track all objects containing code objects for it to be reliable).

As a note, pydevd does have some support for hot-reloading, but there are too many corner-cases and it doesn't work 100% for live coding (it's an unsolved problem is Python) -- and I can't really envision it working for regular breakpoints as there are too many corner cases to handle.
Date User Action Args
2019-11-21 17:01:22fabiozsetrecipients: + fabioz, brett.cannon, vstinner, dino.viehland, Mark.Shannon, eric.snow
2019-11-21 17:01:22fabiozsetmessageid: <>
2019-11-21 17:01:22fabiozlinkissue38500 messages
2019-11-21 17:01:21fabiozcreate