From c11a485d35d878f43bb971f08b9f2ee76d2e5617 Mon Sep 17 00:00:00 2001
From: Elizaveta Shashkova <Elizaveta.Shashkova@jetbrains.com>
Date: Fri, 7 Apr 2017 19:28:30 +0300
Subject: [PATCH] Fix Debug Console when attaching to IPython process
 (PY-20531)

---
 .../pydev/_pydev_bundle/pydev_ipython_console_011.py       | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/python/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py b/python/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py
index 7745c7b60549..b7705c6f680d 100644
--- a/python/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py
+++ b/python/helpers/pydev/_pydev_bundle/pydev_ipython_console_011.py
@@ -313,16 +313,17 @@ class _PyDevFrontEnd:
     version = release.__version__
 
     def __init__(self, show_banner=True):
-
         # Create and initialize our IPython instance.
-        self.ipython = PyDevTerminalInteractiveShell.instance()
+        if hasattr(PyDevTerminalInteractiveShell, '_instance') and PyDevTerminalInteractiveShell._instance is not None:
+            self.ipython = PyDevTerminalInteractiveShell._instance
+        else:
+            self.ipython = PyDevTerminalInteractiveShell.instance()
 
         if show_banner:
             # Display the IPython banner, this has version info and
             # help info
             self.ipython.show_banner()
 
-
         self._curr_exec_line = 0
         self._curr_exec_lines = []
 
-- 
GitLab