From 7d85461e9798793bc2ecbc8aaba5175de05fe92b Mon Sep 17 00:00:00 2001 From: Richard Berger Date: Fri, 2 Apr 2021 16:32:25 -0400 Subject: [PATCH] Prevent compilation from breaking with Python 2 --- src/PYTHON/python_impl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/PYTHON/python_impl.cpp b/src/PYTHON/python_impl.cpp index 4c43ca3744..c83385410a 100644 --- a/src/PYTHON/python_impl.cpp +++ b/src/PYTHON/python_impl.cpp @@ -56,6 +56,8 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) nfunc = 0; pfuncs = nullptr; +#if PY_MAJOR_VERSION >= 3 +#ifndef Py_LIMITED_API // check for PYTHONUNBUFFERED environment variable const char * PYTHONUNBUFFERED = getenv("PYTHONUNBUFFERED"); @@ -64,6 +66,8 @@ PythonImpl::PythonImpl(LAMMPS *lmp) : Pointers(lmp) // Force the stdout and stderr streams to be unbuffered. Py_UnbufferedStdioFlag = 1; } +#endif +#endif // one-time initialization of Python interpreter // pyMain stores pointer to main module