This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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 <1574355682.12.0.794122024827.issue38500@roundup.psfhosted.org>
In-reply-to
Content
@Mark

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.
History
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: <1574355682.12.0.794122024827.issue38500@roundup.psfhosted.org>
2019-11-21 17:01:22fabiozlinkissue38500 messages
2019-11-21 17:01:21fabiozcreate