Fix debugging for IronPython (PY-20959)

This commit is contained in:
Elizaveta Shashkova
2018-03-29 18:22:47 +03:00
parent 0921944fd1
commit 7637bcd46b
2 changed files with 17 additions and 3 deletions
@@ -67,12 +67,18 @@ from _pydev_imps._pydev_saved_modules import threading
from _pydev_imps._pydev_saved_modules import socket
from socket import socket, AF_INET, SOCK_STREAM, SHUT_RD, SHUT_WR, SOL_SOCKET, SO_REUSEADDR, SHUT_RDWR, timeout
from _pydevd_bundle.pydevd_constants import DebugInfoHolder, get_thread_id, IS_JYTHON, IS_PY2, IS_PY3K, \
IS_PY36_OR_GREATER, STATE_RUN, dict_keys, ASYNC_EVAL_TIMEOUT_SEC
IS_PY36_OR_GREATER, STATE_RUN, dict_keys, ASYNC_EVAL_TIMEOUT_SEC, IS_IRONPYTHON
try:
from urllib import quote_plus, unquote, unquote_plus
except:
from urllib.parse import quote_plus, unquote, unquote_plus #@Reimport @UnresolvedImport
if IS_IRONPYTHON:
# redefine `unquote` for IronPython, since we use it only for logging messages, but it leads to SOF with IronPython
def unquote(s):
return s
import pydevconsole
from _pydevd_bundle import pydevd_vars
from _pydevd_bundle import pydevd_xml
@@ -20,8 +20,18 @@ class DebugInfoHolder:
#Hold a reference to the original _getframe (because psyco will change that as soon as it's imported)
import sys #Note: the sys import must be here anyways (others depend on it)
IS_IRONPYTHON = sys.platform == 'cli'
try:
get_frame = sys._getframe
if IS_IRONPYTHON:
def get_frame():
try:
return sys._getframe()
except ValueError:
if IS_IRONPYTHON:
pass
else:
raise
except AttributeError:
def get_frame():
raise AssertionError('sys._getframe not available (possible causes: enable -X:Frames on IronPython?)')
@@ -38,8 +48,6 @@ import os
from _pydevd_bundle import pydevd_vm_type
IS_JYTHON = pydevd_vm_type.get_vm_type() == pydevd_vm_type.PydevdVmType.JYTHON
IS_IRONPYTHON = sys.platform == 'cli'
IS_JYTH_LESS25 = False
if IS_JYTHON:
if sys.version_info[0] == 2 and sys.version_info[1] < 5: