sim: Prepare C++ side for Python 3
Python 3 uses wide strings instead of ordinary strings for many APIs. Add the necessary conversions to comply with the new API. Change-Id: I6f45c9c532537d50d54b542f34eb8fd8cb375874 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15977 Reviewed-by: Gabe Black <gabeblack@google.com> Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
This commit is contained in:
@@ -45,7 +45,14 @@ main(int argc, char **argv)
|
||||
// Initialize m5 special signal handling.
|
||||
initSignals();
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
std::unique_ptr<wchar_t[], decltype(&PyMem_RawFree)> program(
|
||||
Py_DecodeLocale(argv[0], NULL),
|
||||
&PyMem_RawFree);
|
||||
Py_SetProgramName(program.get());
|
||||
#else
|
||||
Py_SetProgramName(argv[0]);
|
||||
#endif
|
||||
|
||||
// initialize embedded Python interpreter
|
||||
Py_Initialize();
|
||||
|
||||
Reference in New Issue
Block a user