Repository navigation
Compile code with debug symbols instead of interpreting it - #2174
Merged
Merged
Conversation
slozier
approved these changes
Nov 22, 2026
slozier
left a comment
Contributor
There was a problem hiding this comment.
Thanks! Good catch, might be worth obsoleting our overload and adding one called CompileWithDebugSymbols (or something).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
-X Debug, module code, and the functions and classes compiled with it, ran in theSystem.Linq.Expressionsinterpreter instead of being compiled.RuntimeScriptCodeandPythonScriptCodecalllambda.Compile(pc.EmitDebugSymbols(...)). The intended target is the DLR extension methodCompilerHelpers.Compile<T>(this Expression<T>, bool emitDebugSymbols). On .NET and .NET Standard 2.0, however,Expression<T>has an instance methodCompile(bool preferInterpretation), and C# picks it over the extension, sotruemeant "interpret". The three call sites now callCompilerHelpers.Compileas a static method. .NET Framework was not affected, because itsExpression<T>has noCompile(bool). I guess this fell between the cracks when IronPython was ported to .NET Core. Not a big deal, since the whole-X Debugwas meant primarily for Visual Studio (my guess), and now it is kind of defunct, but the code should still work here. Getting the whole-X Debugto work is another issue.test_debug_compile.pychecks that module code, a function and a class body have no interpreter frames on the .NET stack. There is one test per call site:-X Debug(RuntimeScriptCode)-X Debug -X Tracing(PythonScriptCode, tracing target)PythonScriptCode)