2023-08-22 11:15:46 -04:00
|
|
|
import io
|
2018-06-04 16:24:15 +10:00
|
|
|
|
|
|
|
try:
|
|
|
|
io.IOBase
|
|
|
|
except AttributeError:
|
2021-03-15 19:27:36 +05:30
|
|
|
print("SKIP")
|
2018-06-04 16:24:15 +10:00
|
|
|
raise SystemExit
|
|
|
|
|
|
|
|
|
|
|
|
class MyIO(io.IOBase):
|
|
|
|
def write(self, buf):
|
|
|
|
# CPython and uPy pass in different types for buf (str vs bytearray)
|
2021-03-15 19:27:36 +05:30
|
|
|
print("write", len(buf))
|
2018-06-04 16:24:15 +10:00
|
|
|
return len(buf)
|
|
|
|
|
2021-03-15 19:27:36 +05:30
|
|
|
|
|
|
|
print("test", file=MyIO())
|