diff --git a/python/helpers/pydev/_pydev_bundle/pydev_monkey.py b/python/helpers/pydev/_pydev_bundle/pydev_monkey.py index 05c552c250e0..c581e6f5b24f 100644 --- a/python/helpers/pydev/_pydev_bundle/pydev_monkey.py +++ b/python/helpers/pydev/_pydev_bundle/pydev_monkey.py @@ -451,7 +451,6 @@ def create_execl(original_name): import os args = patch_args(args) if is_python_args(args): - path = args[0] send_process_will_be_substituted() return getattr(os, original_name)(path, *args) return new_execl @@ -466,7 +465,6 @@ def create_execv(original_name): import os args = patch_args(args) if is_python_args(args): - path = args[0] send_process_will_be_substituted() return getattr(os, original_name)(path, args) return new_execv @@ -481,7 +479,6 @@ def create_execve(original_name): import os args = patch_args(args) if is_python_args(args): - path = args[0] send_process_will_be_substituted() return getattr(os, original_name)(path, args, env) return new_execve diff --git a/python/testData/debug/test_call_exec_with_python_arg.py b/python/testData/debug/test_call_exec_with_python_arg.py new file mode 100644 index 000000000000..e1f17f5b0bde --- /dev/null +++ b/python/testData/debug/test_call_exec_with_python_arg.py @@ -0,0 +1,5 @@ +import os +import sys + +args = ['python', 'test4.py'] +os.execv(sys.executable, args) diff --git a/python/testData/debug/test_call_python_version.py b/python/testData/debug/test_call_python_version.py new file mode 100644 index 000000000000..401d4b0ac066 --- /dev/null +++ b/python/testData/debug/test_call_python_version.py @@ -0,0 +1,3 @@ +import subprocess + +subprocess.call(['python', '-V']) diff --git a/python/testSrc/com/jetbrains/env/debug/PythonDebuggerMultiprocessingTest.java b/python/testSrc/com/jetbrains/env/debug/PythonDebuggerMultiprocessingTest.java index 46242fcb6d28..25efb54e7c3f 100644 --- a/python/testSrc/com/jetbrains/env/debug/PythonDebuggerMultiprocessingTest.java +++ b/python/testSrc/com/jetbrains/env/debug/PythonDebuggerMultiprocessingTest.java @@ -239,4 +239,45 @@ public class PythonDebuggerMultiprocessingTest extends PyEnvTestCase { } }); } + + @Test + public void testCallExecWithPythonArg() { + runPythonTest(new PyDebuggerTask("/debug", "test_call_exec_with_python_arg.py") { + @Override + protected void init() { + setMultiprocessDebug(true); + } + + @Override + public void before() { + toggleBreakpoint(getFilePath("test4.py"), 1); + } + + @Override + public void testing() throws Exception { + waitForPause(); + setProcessCanTerminate(true); + resume(); + waitForOutput("3"); + } + + @Override + public @NotNull Set getTags() { + return Collections.singleton("python2.7"); + } + }); + + runPythonTest(new PyDebuggerTask("/debug", "test_call_python_version.py") { + @Override + public void testing() throws Exception { + waitForTerminate(); + outputContains("Python"); + } + + @Override + public @NotNull Set getTags() { + return Collections.singleton("python2.7"); + } + }); + } }