Skip to content

Commit 628dc7c

Browse files
committed
fix: avoid changing class outside of GIL
1 parent 683faf2 commit 628dc7c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: include/pybind11/iostream.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,12 @@ class pythonbuf : public std::streambuf {
5252

5353
pywrite(line);
5454
pyflush();
55+
56+
// Placed inside gil_scoped_aquire as a makeshift mutex
57+
// to reduce MSVC issues
58+
setp(pbase(), epptr());
5559
}
5660

57-
setp(pbase(), epptr());
5861
}
5962
return 0;
6063
}

0 commit comments

Comments
 (0)