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 Mark.Shannon
Recipients Mark.Shannon, brett.cannon, dino.viehland, eric.snow, fabioz, vstinner
Date 2019-11-11.12:04:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1573473894.01.0.582251602163.issue38500@roundup.psfhosted.org>
In-reply-to
Content
Fabio,

If the user changes the `__code__` attribute of a function then, AFAICT, your debugger does the wrong thing, but bytecode modification does the right thing.

Suppose we have two functions `spam` and `eggs`.
Set a break point in `eggs`, set `spam.__code__ = eggs.__code__`, then call `spam`.
With bytecode modification, we get the correct result. That is, execution breaks in the source code of `eggs` when `spam` is run.
I think your debugger will do the wrong thing as it will execute the original code of `spam`. Could you confirm what it does?

But that's not the main issue, IMO. The big problem is that changing out the interpreter is not composable, unlike bytecode modification.

Suppose we have MyProfiler and YourDebugger.
MyProfiler wants to record calls and YourDebugger wants to support breakpoints.

With bytecode modification, and some care, we can do both.
Swapping out the interpreter is likely to cause all sorts of errors and confusion.
History
Date User Action Args
2019-11-11 12:04:54Mark.Shannonsetrecipients: + Mark.Shannon, brett.cannon, vstinner, fabioz, dino.viehland, eric.snow
2019-11-11 12:04:54Mark.Shannonsetmessageid: <1573473894.01.0.582251602163.issue38500@roundup.psfhosted.org>
2019-11-11 12:04:53Mark.Shannonlinkissue38500 messages
2019-11-11 12:04:53Mark.Shannoncreate