From 2e91b095b315c7366301629215370413b722dbf3 2023-09-19 07:53:47 From: Matthias Bussonnier Date: 2023-09-19 07:53:47 Subject: [PATCH] Set instance on singleton configurable when created via constructor. See #14164 --- diff --git a/IPython/terminal/embed.py b/IPython/terminal/embed.py index ce5ee01..59fa610 100644 --- a/IPython/terminal/embed.py +++ b/IPython/terminal/embed.py @@ -158,6 +158,12 @@ class InteractiveShellEmbed(TerminalInteractiveShell): assert ( "user_global_ns" not in kw ), "Key word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0." + # temporary fix for https://github.com/ipython/ipython/issues/14164 + cls = type(self) + if cls._instance is None: + for subclass in cls._walk_mro(): + subclass._instance = self + cls._instance = self clid = kw.pop('_init_location_id', None) if not clid: