61 assert(Py_IsInitialized());
63 PyObject* out = PySys_GetObject(pipename);
69 if (out == NULL || out == Py_None)
71 std::string register_read_write = std::string(
"import sys\n\
72sys.") + pipename + std::string(
" = type(\"\",(object,),{\"write\":lambda self, txt: None, \"flush\":lambda self: None})()\n");
74 PyRun_SimpleString(register_read_write.c_str());
75 out = PySys_GetObject(pipename);
78 PyObject_SetAttrString(out,
"write",