PY-36726 Fix debugging for some old Python versions

GitOrigin-RevId: 61fe96ab129b7eddb8394faa67e8557480bc2982
This commit is contained in:
Andrey Lisin
2019-07-31 13:47:58 +03:00
committed by intellij-monorepo-bot
parent 08210fb4d2
commit ce63f394dd
4 changed files with 31 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ else:
(sys.version_info[0] == 2 and sys.version_info[1] >= 7)
or (sys.version_info[0] == 3 and sys.version_info[1] >= 5)
or (sys.version_info[0] > 3)
):
):
# Supported in 2.7 or 3.5 onwards (32 or 64)
CYTHON_SUPPORTED = True
@@ -257,10 +257,10 @@ except:
NO_FTRACE = None
if sys.version_info[:2] in ((2, 6), (3, 3), (3, 4)):
if sys.version_info[:2] in ((3, 3), (3, 4), (3, 5)) or sys.version_info < (2, 7, 12):
def NO_FTRACE(frame, event, arg):
# In Python <= 2.6 and <= 3.4, if we're tracing a method, frame.f_trace may not be set
# In Python < 2.7.12 and <= 3.5, if we're tracing a method, frame.f_trace may not be set
# to None, it must always be set to a tracing function.
# See: tests_python.test_tracing_gotchas.test_tracing_gotchas
return None

View File

@@ -17,7 +17,7 @@ use_frame_eval = os.environ.get('PYDEVD_USE_FRAME_EVAL', None)
use_cython = os.getenv('PYDEVD_USE_CYTHON', None)
if not IS_PY36_OR_GREATER:
if not IS_PY36_OR_GREATER or sys.version_info[:3] == (3, 6, 1): # PY-37312
pass
elif use_cython == 'NO':

View File

@@ -0,0 +1,9 @@
from __future__ import print_function
import os
import subprocess
import sys
ret = subprocess.call([os.path.abspath(sys.executable), "test_python_subprocess_another_helper.py"])
print("The subprocess finished with the return code %d." % ret)

View File

@@ -2219,4 +2219,22 @@ public class PythonDebuggerTest extends PyEnvTestCase {
}
});
}
@Test
public void testSubprocess() {
runPythonTest(new PyDebuggerTask("/debug", "test_subprocess.py") {
@Override
public void before() throws Exception {
toggleBreakpoint(getFilePath(getScriptName()), 8);
}
@Override
public void testing() throws Exception {
waitForPause();
resume();
waitForTerminate();
outputContains("The subprocess finished with the return code 0.");
}
});
}
}