Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
2cbafb05
Commit
2cbafb05
authored
Aug 29, 2018
by
Justin Bassett
Committed by
Wenzel Jakob
Aug 29, 2018
Browse files
fix detail::pythonbuf::overflow()'s return value to return not_eof(c) (#1479)
parent
3789b4f9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
include/pybind11/iostream.h
include/pybind11/iostream.h
+1
-1
tests/test_iostream.py
tests/test_iostream.py
+10
-0
No files found.
include/pybind11/iostream.h
View file @
2cbafb05
...
@@ -34,7 +34,7 @@ private:
...
@@ -34,7 +34,7 @@ private:
*
pptr
()
=
traits_type
::
to_char_type
(
c
);
*
pptr
()
=
traits_type
::
to_char_type
(
c
);
pbump
(
1
);
pbump
(
1
);
}
}
return
sync
()
?
traits_type
::
not_eof
(
c
)
:
traits_type
::
eof
();
return
sync
()
==
0
?
traits_type
::
not_eof
(
c
)
:
traits_type
::
eof
();
}
}
int
sync
()
{
int
sync
()
{
...
...
tests/test_iostream.py
View file @
2cbafb05
...
@@ -53,6 +53,16 @@ def test_captured(capsys):
...
@@ -53,6 +53,16 @@ def test_captured(capsys):
assert
stdout
==
''
assert
stdout
==
''
assert
stderr
==
msg
assert
stderr
==
msg
def
test_captured_large_string
(
capsys
):
# Make this bigger than the buffer used on the C++ side: 1024 chars
msg
=
"I've been redirected to Python, I hope!"
msg
=
msg
*
(
1024
//
len
(
msg
)
+
1
)
m
.
captured_output_default
(
msg
)
stdout
,
stderr
=
capsys
.
readouterr
()
assert
stdout
==
msg
assert
stderr
==
''
def
test_guard_capture
(
capsys
):
def
test_guard_capture
(
capsys
):
msg
=
"I've been redirected to Python, I hope!"
msg
=
"I've been redirected to Python, I hope!"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment