We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 683faf2 commit 71a28d5Copy full SHA for 71a28d5
include/pybind11/iostream.h
@@ -52,9 +52,12 @@ class pythonbuf : public std::streambuf {
52
53
pywrite(line);
54
pyflush();
55
+
56
+ // Placed inside gil_scoped_aquire as a makeshift mutex
57
+ // to reduce MSVC issues
58
+ setp(pbase(), epptr());
59
}
60
- setp(pbase(), epptr());
61
62
return 0;
63
@@ -70,6 +73,8 @@ class pythonbuf : public std::streambuf {
70
73
d_buffer(new char[buf_size]),
71
74
pywrite(pyostream.attr("write")),
72
75
pyflush(pyostream.attr("flush")) {
76
+ // This is a makeshift mutex to reduce MSVC issues
77
+ gil_scoped_acquire tmp;
78
setp(d_buffer.get(), d_buffer.get() + buf_size - 1);
79
80
0 commit comments