2023-08-22 11:15:46 -04:00
|
|
|
import io
|
2018-06-04 02:24:15 -04:00
|
|
|
|
|
|
|
try:
|
|
|
|
io.IOBase
|
|
|
|
except AttributeError:
|
2021-03-15 09:57:36 -04:00
|
|
|
print("SKIP")
|
2018-06-04 02:24:15 -04: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 09:57:36 -04:00
|
|
|
print("write", len(buf))
|
2018-06-04 02:24:15 -04:00
|
|
|
return len(buf)
|
|
|
|
|
2021-03-15 09:57:36 -04:00
|
|
|
|
|
|
|
print("test", file=MyIO())
|