@@ -420,21 +420,21 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
420420 run_string.Printf (" %s = dict()" , m_dictionary_name.c_str ());
421421
422422 Locker locker (this , Locker::AcquireLock, Locker::FreeAcquiredLock);
423- PyRun_SimpleString (run_string.GetData ());
423+ RunSimpleString (run_string.GetData ());
424424
425425 run_string.Clear ();
426426 run_string.Printf (
427427 " run_one_line (%s, 'import copy, keyword, os, re, sys, uuid, lldb')" ,
428428 m_dictionary_name.c_str ());
429- PyRun_SimpleString (run_string.GetData ());
429+ RunSimpleString (run_string.GetData ());
430430
431431 // Reloading modules requires a different syntax in Python 2 and Python 3.
432432 // This provides a consistent syntax no matter what version of Python.
433433 run_string.Clear ();
434434 run_string.Printf (
435435 " run_one_line (%s, 'from importlib import reload as reload_module')" ,
436436 m_dictionary_name.c_str ());
437- PyRun_SimpleString (run_string.GetData ());
437+ RunSimpleString (run_string.GetData ());
438438
439439 // WARNING: temporary code that loads Cocoa formatters - this should be done
440440 // on a per-platform basis rather than loading the whole set and letting the
@@ -444,20 +444,20 @@ ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
444444 run_string.Printf (
445445 " run_one_line (%s, 'import lldb.formatters, lldb.formatters.cpp')" ,
446446 m_dictionary_name.c_str ());
447- PyRun_SimpleString (run_string.GetData ());
447+ RunSimpleString (run_string.GetData ());
448448 run_string.Clear ();
449449
450450 run_string.Printf (" run_one_line (%s, 'import lldb.embedded_interpreter; from "
451451 " lldb.embedded_interpreter import run_python_interpreter; "
452452 " from lldb.embedded_interpreter import run_one_line')" ,
453453 m_dictionary_name.c_str ());
454- PyRun_SimpleString (run_string.GetData ());
454+ RunSimpleString (run_string.GetData ());
455455 run_string.Clear ();
456456
457457 run_string.Printf (" run_one_line (%s, 'lldb.debugger_unique_id = %" PRIu64
458458 " ')" ,
459459 m_dictionary_name.c_str (), m_debugger.GetID ());
460- PyRun_SimpleString (run_string.GetData ());
460+ RunSimpleString (run_string.GetData ());
461461}
462462
463463ScriptInterpreterPythonImpl::~ScriptInterpreterPythonImpl () {
@@ -572,8 +572,8 @@ void ScriptInterpreterPythonImpl::LeaveSession() {
572572 log->PutCString (" ScriptInterpreterPythonImpl::LeaveSession()" );
573573
574574 // Unset the LLDB global variables.
575- PyRun_SimpleString (" lldb.debugger = None; lldb.target = None; lldb.process "
576- " = None; lldb.thread = None; lldb.frame = None" );
575+ RunSimpleString (" lldb.debugger = None; lldb.target = None; lldb.process "
576+ " = None; lldb.thread = None; lldb.frame = None" );
577577
578578 // checking that we have a valid thread state - since we use our own
579579 // threading and locking in some (rare) cases during cleanup Python may end
@@ -674,7 +674,7 @@ bool ScriptInterpreterPythonImpl::EnterSession(uint16_t on_entry_flags,
674674 run_string.PutCString (" ')" );
675675 }
676676
677- PyRun_SimpleString (run_string.GetData ());
677+ RunSimpleString (run_string.GetData ());
678678 run_string.Clear ();
679679
680680 PythonDictionary &sys_module_dict = GetSysModuleDictionary ();
@@ -816,9 +816,9 @@ bool ScriptInterpreterPythonImpl::ExecuteOneLine(
816816
817817 if (!command.empty ()) {
818818 // We want to call run_one_line, passing in the dictionary and the command
819- // string. We cannot do this through PyRun_SimpleString here because the
819+ // string. We cannot do this through RunSimpleString here because the
820820 // command string may contain escaped characters, and putting it inside
821- // another string to pass to PyRun_SimpleString messes up the escaping. So
821+ // another string to pass to RunSimpleString messes up the escaping. So
822822 // we use the following more complicated method to pass the command string
823823 // directly down to Python.
824824 llvm::Expected<std::unique_ptr<ScriptInterpreterIORedirect>>
@@ -3057,7 +3057,7 @@ void ScriptInterpreterPythonImpl::Initialize() {
30573057 // Update the path python uses to search for modules to include the current
30583058 // directory.
30593059
3060- PyRun_SimpleString (" import sys" );
3060+ RunSimpleString (" import sys" );
30613061 AddToSysPath (AddLocation::End, " ." );
30623062
30633063 // Don't denormalize paths when calling file_spec.GetPath(). On platforms
@@ -3069,10 +3069,10 @@ void ScriptInterpreterPythonImpl::Initialize() {
30693069 if (FileSpec file_spec = HostInfo::GetShlibDir ())
30703070 AddToSysPath (AddLocation::Beginning, file_spec.GetPath (false ));
30713071
3072- PyRun_SimpleString (" sys.dont_write_bytecode = 1; import "
3073- " lldb.embedded_interpreter; from "
3074- " lldb.embedded_interpreter import run_python_interpreter; "
3075- " from lldb.embedded_interpreter import run_one_line" );
3072+ RunSimpleString (" sys.dont_write_bytecode = 1; import "
3073+ " lldb.embedded_interpreter; from "
3074+ " lldb.embedded_interpreter import run_python_interpreter; "
3075+ " from lldb.embedded_interpreter import run_one_line" );
30763076
30773077#if LLDB_USE_PYTHON_SET_INTERRUPT
30783078 // Python will not just overwrite its internal SIGINT handler but also the
@@ -3084,13 +3084,13 @@ void ScriptInterpreterPythonImpl::Initialize() {
30843084 // normal Python REPL signal handler which raises a KeyboardInterrupt.
30853085 // Also make sure to not pollute the user's REPL with the signal module nor
30863086 // our utility function.
3087- PyRun_SimpleString (" def lldb_setup_sigint_handler():\n "
3088- " import signal;\n "
3089- " def signal_handler(sig, frame):\n "
3090- " raise KeyboardInterrupt()\n "
3091- " signal.signal(signal.SIGINT, signal_handler);\n "
3092- " lldb_setup_sigint_handler();\n "
3093- " del lldb_setup_sigint_handler\n " );
3087+ RunSimpleString (" def lldb_setup_sigint_handler():\n "
3088+ " import signal;\n "
3089+ " def signal_handler(sig, frame):\n "
3090+ " raise KeyboardInterrupt()\n "
3091+ " signal.signal(signal.SIGINT, signal_handler);\n "
3092+ " lldb_setup_sigint_handler();\n "
3093+ " del lldb_setup_sigint_handler\n " );
30943094#endif
30953095}
30963096
@@ -3106,7 +3106,7 @@ void ScriptInterpreterPythonImpl::AddToSysPath(AddLocation location,
31063106 statement.append (path);
31073107 statement.append (" \" )" );
31083108 }
3109- PyRun_SimpleString (statement.c_str ());
3109+ RunSimpleString (statement.c_str ());
31103110}
31113111
31123112// We are intentionally NOT calling Py_Finalize here (this would be the logical
0 commit comments