You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
code.InteractiveConsole.push attempts to support multi-line input when using an input method that doesn't reliably split on newlines.
This support fails as soon as the multi-line input contains multiple statements (including when the last statement is incomplete).
However, switching to 'exec' instead of 'single' causes other problems - specifically, it turns off the expression printing.
While expression printing could be implied by the PyCF_DONT_IMPLY_DEDENT flag in addition to the "single" evaluation mode, it seems cleaner to break out the expression printing behaviour into its own flag and setting it appropriately in the code and/or codeop modules.
Not when the string is provided as one big block of text. I haven't checked
yet if including a blank line after compound statements makes a difference,
though.
Activity
ncoghlan commentedon Dec 9, 2012
code.InteractiveConsole.push attempts to support multi-line input when using an input method that doesn't reliably split on newlines.
This support fails as soon as the multi-line input contains multiple statements (including when the last statement is incomplete).
However, switching to 'exec' instead of 'single' causes other problems - specifically, it turns off the expression printing.
While expression printing could be implied by the PyCF_DONT_IMPLY_DEDENT flag in addition to the "single" evaluation mode, it seems cleaner to break out the expression printing behaviour into its own flag and setting it appropriately in the code and/or codeop modules.
[-]Add a PyCF_PRINT_EXPRESSION_RESULTS flag[/-][+]Add a PyCF_DISPLAY_EXPRESSION_RESULTS flag[/+]benjaminp commentedon Dec 9, 2012
I'm sort of surprised "single" doesn't handle that already. Should it not?
ncoghlan commentedon Dec 9, 2012
Not when the string is provided as one big block of text. I haven't checked
yet if including a blank line after compound statements makes a difference,
though.
devdanzin commentedon Sep 18, 2025
Is this one still relevant?