diff --git a/src/PYTHON/fix_python_invoke.cpp b/src/PYTHON/fix_python_invoke.cpp index 6483e21f91..7d981a749e 100644 --- a/src/PYTHON/fix_python_invoke.cpp +++ b/src/PYTHON/fix_python_invoke.cpp @@ -92,8 +92,9 @@ int FixPythonInvoke::setmask() void FixPythonInvoke::end_of_step() { PyUtils::GIL lock; + char fmt[] = "O"; - PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "O", (PyObject*)lmpPtr); + PyObject * result = PyObject_CallFunction((PyObject*)pFunc, fmt, (PyObject*)lmpPtr); if (!result) { PyUtils::Print_Errors(); @@ -110,8 +111,9 @@ void FixPythonInvoke::post_force(int vflag) if (update->ntimestep % nevery != 0) return; PyUtils::GIL lock; + char fmt[] = "Oi"; - PyObject * result = PyObject_CallFunction((PyObject*)pFunc, "Oi", (PyObject*)lmpPtr, vflag); + PyObject * result = PyObject_CallFunction((PyObject*)pFunc, fmt, (PyObject*)lmpPtr, vflag); if (!result) { PyUtils::Print_Errors(); diff --git a/src/PYTHON/fix_python_move.cpp b/src/PYTHON/fix_python_move.cpp index e04a32afe4..8ec2e1b74d 100644 --- a/src/PYTHON/fix_python_move.cpp +++ b/src/PYTHON/fix_python_move.cpp @@ -75,7 +75,7 @@ FixPythonMove::FixPythonMove(LAMMPS *lmp, int narg, char **arg) : } PyObject *ptr = PY_VOID_POINTER(lmp); - PyObject *py_move_obj = PyObject_CallFunction(py_move_type, "O", ptr); + PyObject *py_move_obj = PyObject_CallFunction(py_move_type, (char *)"O", ptr); Py_CLEAR(ptr); if (!py_move_obj) { @@ -112,7 +112,7 @@ int FixPythonMove::setmask() void FixPythonMove::init() { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject *)py_move, "init", nullptr); + PyObject * result = PyObject_CallMethod((PyObject *)py_move, (char *)"init", nullptr); if (!result) { PyUtils::Print_Errors(); @@ -126,7 +126,7 @@ void FixPythonMove::init() void FixPythonMove::initial_integrate(int vflag) { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate", "i", vflag); + PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"initial_integrate", (char *)"i", vflag); if (!result) { PyUtils::Print_Errors(); @@ -140,7 +140,7 @@ void FixPythonMove::initial_integrate(int vflag) void FixPythonMove::final_integrate() { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate", nullptr); + PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"final_integrate", nullptr); if (!result) { PyUtils::Print_Errors(); @@ -154,7 +154,7 @@ void FixPythonMove::final_integrate() void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop) { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject*)py_move, "initial_integrate_respa", "iii", vflag, ilevel, iloop); + PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"initial_integrate_respa", (char *)"iii", vflag, ilevel, iloop); if (!result) { PyUtils::Print_Errors(); @@ -168,7 +168,7 @@ void FixPythonMove::initial_integrate_respa(int vflag, int ilevel, int iloop) void FixPythonMove::final_integrate_respa(int ilevel, int iloop) { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject*)py_move, "final_integrate_respa", "ii", ilevel, iloop); + PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"final_integrate_respa", (char *)"ii", ilevel, iloop); if (!result) { PyUtils::Print_Errors(); @@ -182,7 +182,7 @@ void FixPythonMove::final_integrate_respa(int ilevel, int iloop) void FixPythonMove::reset_dt() { PyUtils::GIL lock; - PyObject * result = PyObject_CallMethod((PyObject*)py_move, "reset_dt", nullptr); + PyObject * result = PyObject_CallMethod((PyObject*)py_move, (char *)"reset_dt", nullptr); if (!result) { PyUtils::Print_Errors(); diff --git a/src/PYTHON/pair_python.cpp b/src/PYTHON/pair_python.cpp index b147c9cb79..5020119e0d 100644 --- a/src/PYTHON/pair_python.cpp +++ b/src/PYTHON/pair_python.cpp @@ -288,7 +288,7 @@ void PairPython::coeff(int narg, char **arg) py_potential = (void *) py_pair_instance; - PyObject *py_value = PyObject_CallMethod(py_pair_instance, "check_units", "s", update->unit_style); + PyObject *py_value = PyObject_CallMethod(py_pair_instance, (char *)"check_units", (char *)"s", update->unit_style); if (!py_value) { PyUtils::Print_Errors(); error->all(FLERR,"Calling 'check_units' function failed"); @@ -306,7 +306,7 @@ void PairPython::coeff(int narg, char **arg) } else skip_types[i] = 0; const int type = i; const char * name = arg[2+i]; - py_value = PyObject_CallMethod(py_pair_instance, "map_coeff", "si", name, type); + py_value = PyObject_CallMethod(py_pair_instance, (char *)"map_coeff", (char *)"si", name, type); if (!py_value) { PyUtils::Print_Errors(); error->all(FLERR,"Calling 'map_coeff' function failed");