Skip to content

Commit 45a91d8

Browse files
committed
Remove trailing whitespace and formatting iostream
1 parent 9b47409 commit 45a91d8

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

include/pybind11/iostream.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class pythonbuf : public std::streambuf {
4141
return sync() == 0 ? traits_type::not_eof(c) : traits_type::eof();
4242
}
4343

44-
// Computes how many bytes at the end of the buffer are part of an
44+
// Computes how many bytes at the end of the buffer are part of an
4545
// incomplete sequence of UTF-8 bytes.
4646
// Precondition: pbase() < pptr()
4747
size_t utf8_remainder() const {
@@ -71,15 +71,15 @@ class pythonbuf : public std::streambuf {
7171
const auto dist = static_cast<size_t>(leading - rpptr);
7272
size_t remainder = 0;
7373

74-
if (dist == 0)
74+
if (dist == 0)
7575
remainder = 1; // 1-byte code point is impossible
7676
else if (dist == 1)
7777
remainder = is_leading_2b(*leading) ? 0 : dist + 1;
7878
else if (dist == 2)
7979
remainder = is_leading_3b(*leading) ? 0 : dist + 1;
8080
// else if (dist >= 3), at least 4 bytes before encountering an UTF-8
8181
// leading byte, either no remainder or invalid UTF-8.
82-
// Invalid UTF-8 will cause an exception later when converting
82+
// Invalid UTF-8 will cause an exception later when converting
8383
// to a Python string, so that's not handled here.
8484
return remainder;
8585
}

tests/test_iostream.py

+10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def test_captured_large_string(capsys):
6868
assert stdout == msg
6969
assert stderr == ""
7070

71+
7172
def test_captured_utf8_2byte_offset0(capsys):
7273
msg = "\u07FF"
7374
msg = "" + msg * (1024 // len(msg) + 1)
@@ -77,6 +78,7 @@ def test_captured_utf8_2byte_offset0(capsys):
7778
assert stdout == msg
7879
assert stderr == ""
7980

81+
8082
def test_captured_utf8_2byte_offset1(capsys):
8183
msg = "\u07FF"
8284
msg = "1" + msg * (1024 // len(msg) + 1)
@@ -86,6 +88,7 @@ def test_captured_utf8_2byte_offset1(capsys):
8688
assert stdout == msg
8789
assert stderr == ""
8890

91+
8992
def test_captured_utf8_3byte_offset0(capsys):
9093
msg = "\uFFFF"
9194
msg = "" + msg * (1024 // len(msg) + 1)
@@ -95,6 +98,7 @@ def test_captured_utf8_3byte_offset0(capsys):
9598
assert stdout == msg
9699
assert stderr == ""
97100

101+
98102
def test_captured_utf8_3byte_offset1(capsys):
99103
msg = "\uFFFF"
100104
msg = "1" + msg * (1024 // len(msg) + 1)
@@ -104,6 +108,7 @@ def test_captured_utf8_3byte_offset1(capsys):
104108
assert stdout == msg
105109
assert stderr == ""
106110

111+
107112
def test_captured_utf8_3byte_offset2(capsys):
108113
msg = "\uFFFF"
109114
msg = "12" + msg * (1024 // len(msg) + 1)
@@ -113,6 +118,7 @@ def test_captured_utf8_3byte_offset2(capsys):
113118
assert stdout == msg
114119
assert stderr == ""
115120

121+
116122
def test_captured_utf8_4byte_offset0(capsys):
117123
msg = "\U0010FFFF"
118124
msg = "" + msg * (1024 // len(msg) + 1)
@@ -122,6 +128,7 @@ def test_captured_utf8_4byte_offset0(capsys):
122128
assert stdout == msg
123129
assert stderr == ""
124130

131+
125132
def test_captured_utf8_4byte_offset1(capsys):
126133
msg = "\U0010FFFF"
127134
msg = "1" + msg * (1024 // len(msg) + 1)
@@ -131,6 +138,7 @@ def test_captured_utf8_4byte_offset1(capsys):
131138
assert stdout == msg
132139
assert stderr == ""
133140

141+
134142
def test_captured_utf8_4byte_offset2(capsys):
135143
msg = "\U0010FFFF"
136144
msg = "12" + msg * (1024 // len(msg) + 1)
@@ -140,6 +148,7 @@ def test_captured_utf8_4byte_offset2(capsys):
140148
assert stdout == msg
141149
assert stderr == ""
142150

151+
143152
def test_captured_utf8_4byte_offset3(capsys):
144153
msg = "\U0010FFFF"
145154
msg = "123" + msg * (1024 // len(msg) + 1)
@@ -149,6 +158,7 @@ def test_captured_utf8_4byte_offset3(capsys):
149158
assert stdout == msg
150159
assert stderr == ""
151160

161+
152162
def test_guard_capture(capsys):
153163
msg = "I've been redirected to Python, I hope!"
154164
m.guard_output(msg)

0 commit comments

Comments
 (0)