File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
FormatStyle : file
2
2
3
3
Checks : '
4
- -*,
5
4
llvm-namespace-comment,
6
5
modernize-use-override,
7
6
readability-container-size-empty,
Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ class pythonbuf : public std::streambuf {
38
38
return sync () == 0 ? traits_type::not_eof (c) : traits_type::eof ();
39
39
}
40
40
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 () {
42
45
if (pbase () != pptr ()) {
43
46
// This subtraction cannot be negative, so dropping the sign
44
47
str line (pbase (), static_cast <size_t >(pptr () - pbase ()));
@@ -54,6 +57,10 @@ class pythonbuf : public std::streambuf {
54
57
return 0 ;
55
58
}
56
59
60
+ int sync () override {
61
+ return _sync ();
62
+ }
63
+
57
64
public:
58
65
59
66
pythonbuf (object pyostream, size_t buffer_size = 1024 )
@@ -68,7 +75,7 @@ class pythonbuf : public std::streambuf {
68
75
69
76
// / Sync before destroy
70
77
~pythonbuf () override {
71
- sync ();
78
+ _sync ();
72
79
}
73
80
};
74
81
You can’t perform that action at this time.
0 commit comments