1try: 2 import uio as io 3except: 4 import io 5 6try: 7 io.IOBase 8except AttributeError: 9 print('SKIP') 10 raise SystemExit 11 12 13class MyIO(io.IOBase): 14 def write(self, buf): 15 # CPython and uPy pass in different types for buf (str vs bytearray) 16 print('write', len(buf)) 17 return len(buf) 18 19print('test', file=MyIO()) 20