File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 11FormatStyle : file
22
33Checks : '
4- -*,
54llvm-namespace-comment,
65modernize-use-override,
76readability-container-size-empty,
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ class pythonbuf : public std::streambuf {
3838 return sync () == 0 ? traits_type::not_eof (c) : traits_type::eof ();
3939 }
4040
41- int sync () override {
41+ // This function must be non-virtual to be called in a destructor. If the
42+ // rare MSVC test failure shows up with this version, then this should be
43+ // simplified to a fully qualified call.
44+ int _sync () {
4245 if (pbase () != pptr ()) {
4346 // This subtraction cannot be negative, so dropping the sign
4447 str line (pbase (), static_cast <size_t >(pptr () - pbase ()));
@@ -54,6 +57,10 @@ class pythonbuf : public std::streambuf {
5457 return 0 ;
5558 }
5659
60+ int sync () override {
61+ return _sync ();
62+ }
63+
5764public:
5865
5966 pythonbuf (object pyostream, size_t buffer_size = 1024 )
@@ -68,7 +75,7 @@ class pythonbuf : public std::streambuf {
6875
6976 // / Sync before destroy
7077 ~pythonbuf () override {
71- sync ();
78+ _sync ();
7279 }
7380};
7481
You can’t perform that action at this time.
0 commit comments