From looking at the CPython source, it appears that it's called with default arguments, which means in blocking mode.
The methods you want to look at in particular are __enter__()
, which is called at the beginning of the with
block, and __exit__()
, which is called at the end.