From 1f69789fd5e766fd41500f42a5c430d79dafec79 2023-09-27 07:28:53 From: Matthias Bussonnier Date: 2023-09-27 07:28:53 Subject: [PATCH] Backport PR #14169 on branch 8.12.x (Set instance on singleton configurable when created via constructor.) (#14170) Backport PR #14169: Set instance on singleton configurable when created via constructor. --- 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: