In debug mode, BaseEventLoop._run_once() now sets the BaseEventLoop._current_handle attribute to the handle currently executed. In release mode or when no handle is executed, the attribute is None. BaseEventLoop.default_exception_handler() displays the traceback of the current handle if available.
12 lines
276 B
Python
12 lines
276 B
Python
import os
|
|
|
|
if __name__ == '__main__':
|
|
while True:
|
|
buf = os.read(0, 1024)
|
|
if not buf:
|
|
break
|
|
try:
|
|
os.write(1, b'OUT:'+buf)
|
|
except OSError as ex:
|
|
os.write(2, b'ERR:' + ex.__class__.__name__.encode('ascii'))
|