(func, *args)
| 75 | |
| 76 | |
| 77 | def _nb_clean(func, *args): |
| 78 | try: |
| 79 | return func(*args) |
| 80 | except (OSError, socket.error): |
| 81 | # Note: In python2 socket.error != OSError (In python3, they are same) |
| 82 | _, e = sys.exc_info()[:2] |
| 83 | if e.errno in (errno.EWOULDBLOCK, errno.EAGAIN): |
| 84 | debug3('%s: err was: %s' % (func.__name__, e)) |
| 85 | return None |
| 86 | else: |
| 87 | # Re-raise other errors (including EPIPE) so they can be handled |
| 88 | # by the calling function appropriately |
| 89 | raise |
| 90 | |
| 91 | |
| 92 | def _try_peername(sock): |