diff options
author | timdechant <timdechant.git@gmail.com> | 2024-08-26 10:34:42 -0400 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-09-06 17:00:35 +1000 |
commit | 455415b1e1199c4364e84cc31905452f7c4ec399 (patch) | |
tree | 36ae9d1a6108e60f20ef2c73f8e03af77213484a /tests/basics/sys_stdio_buffer.py | |
parent | 659113825d10bf2ae71dd215a8597451e505982d (diff) | |
download | micropython-455415b1e1199c4364e84cc31905452f7c4ec399.tar.gz micropython-455415b1e1199c4364e84cc31905452f7c4ec399.zip |
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 <timdechant.git@gmail.com>
Diffstat (limited to 'tests/basics/sys_stdio_buffer.py')
-rw-r--r-- | tests/basics/sys_stdio_buffer.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/basics/sys_stdio_buffer.py b/tests/basics/sys_stdio_buffer.py new file mode 100644 index 0000000000..ae354ec7fb --- /dev/null +++ b/tests/basics/sys_stdio_buffer.py @@ -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))) |