summaryrefslogtreecommitdiff
path: root/src/pyinterp.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/pyinterp.cc')
-rw-r--r--src/pyinterp.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pyinterp.cc b/src/pyinterp.cc
index 5381758e..72995eb6 100644
--- a/src/pyinterp.cc
+++ b/src/pyinterp.cc
@@ -151,6 +151,11 @@ void python_interpreter_t::initialize()
DEBUG("python.interp", "Initializing Python");
#if PY_MAJOR_VERSION >= 3
+ // Unbuffer stdio to avoid python output getting stuck in buffer when
+ // stdout is not a TTY. Normally buffers are flushed by Py_Finalize but
+ // Boost has a long-standing issue preventing proper shutdown of the
+ // interpreter with Py_Finalize when embedded.
+ Py_UnbufferedStdioFlag = 1;
// PyImport_AppendInittab docs: "This should be called before Py_Initialize()".
PyImport_AppendInittab((char*)"ledger", PyInit_ledger);
#endif