From a34713881849b44eb4aa82f8ab1fcd5d48638e33 Mon Sep 17 00:00:00 2001 From: krassowski <5832902+krassowski@users.noreply.github.com> Date: Wed, 4 Jun 2025 10:59:14 +0100 Subject: [PATCH] Backport PR #14830 --- IPython/terminal/embed.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/IPython/terminal/embed.py b/IPython/terminal/embed.py index d46fa7441f..34448d2929 100644 --- a/IPython/terminal/embed.py +++ b/IPython/terminal/embed.py @@ -392,11 +392,21 @@ def embed(*, header="", compile_flags=None, **kwargs): if config is None: config = load_default_config() config.InteractiveShellEmbed = config.TerminalInteractiveShell - kwargs['config'] = config - using = kwargs.get('using', 'sync') - if using : - kwargs['config'].update({'TerminalInteractiveShell':{'loop_runner':using, 'colors':'NoColor', 'autoawait': using!='sync'}}) - #save ps1/ps2 if defined + kwargs["config"] = config + using = kwargs.get("using", "sync") + colors = kwargs.get("colors", "NoColor") + print(colors, using) + if using: + kwargs["config"].update( + { + "TerminalInteractiveShell": { + "loop_runner": using, + "colors": colors, + "autoawait": using != "sync", + } + } + ) + # save ps1/ps2 if defined ps1 = None ps2 = None try: