Mark Shannon <m...@hotpy.org> added the comment:
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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue38500> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com