Debugger hangs on Jython with "Attach to subprocess" option enabled (PY-18742)

We shouldn't update sys.modules for the main thread, cause it leads to the second importing 'threading' module, and the new instance of main thread is created. In this case we lose thread id and thread additional info, so it totally breaks the debugger.
This commit is contained in:
Elizaveta Shashkova
2016-04-04 20:31:16 +03:00
parent 0d8c5de527
commit e29a0ef3b0
@@ -265,7 +265,9 @@ class PyDBDaemonThread(threading.Thread):
created_pydb_daemon[self] = 1
try:
try:
if IS_JYTHON:
if IS_JYTHON and not isinstance(threading.currentThread(), threading._MainThread):
# we shouldn't update sys.modules for the main thread, cause it leads to the second importing 'threading'
# module, and the new instance of main thread is created
import org.python.core as PyCore #@UnresolvedImport
ss = PyCore.PySystemState()
# Note: Py.setSystemState() affects only the current thread.