forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shared/runtime/sys_stdio_mphal: Fix printed type for stdio streams.
The printed type for stdio streams indicates "FileIO", which is a binary IO stream. Stdio is not binary by design, and its printed type should indicate a text stream. "TextIOWrapper" suits that purpose, and is used by VfsPosix files. Signed-off-by: timdechant <[email protected]>
- Loading branch information
1 parent
6591138
commit 455415b
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Test sys.std* objects. | ||
|
||
import sys | ||
|
||
try: | ||
sys.stdout | ||
sys.stdin | ||
sys.stderr | ||
except AttributeError: | ||
print("SKIP") | ||
raise SystemExit | ||
|
||
# CPython is more verbose; no need to match exactly | ||
|
||
print('TextIOWrapper' in str(sys.stdout)) | ||
print('TextIOWrapper' in str(sys.stderr)) | ||
print('TextIOWrapper' in str(sys.stdin)) | ||
|
||
print('TextIOWrapper' in str(type(sys.stdout))) | ||
print('TextIOWrapper' in str(type(sys.stderr))) | ||
print('TextIOWrapper' in str(type(sys.stdin))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Test sys.std*.buffer objects. | ||
|
||
import sys | ||
|
||
try: | ||
sys.stdout.buffer | ||
sys.stdin.buffer | ||
sys.stderr.buffer | ||
except AttributeError: | ||
print("SKIP") | ||
raise SystemExit | ||
|
||
# CPython is more verbose; no need to match exactly | ||
|
||
print('FileIO' in str(sys.stdout.buffer)) | ||
print('FileIO' in str(sys.stderr.buffer)) | ||
print('FileIO' in str(sys.stdin.buffer)) | ||
|
||
print('FileIO' in str(type(sys.stdout.buffer))) | ||
print('FileIO' in str(type(sys.stderr.buffer))) | ||
print('FileIO' in str(type(sys.stdin.buffer))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
True | ||
True | ||
True | ||
True | ||
True | ||
True |