eventloop.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:shadowsocksR-b 作者: hao35954514 项目源码 文件源码
def errno_from_exception(e):
    """Provides the errno from an Exception object.

    There are cases that the errno attribute was not set so we pull
    the errno out of the args but if someone instatiates an Exception
    without any args you will get a tuple error. So this function
    abstracts all that behavior to give you a safe way to get the
    errno.
    """

    if hasattr(e, 'errno'):
        return e.errno
    elif e.args:
        return e.args[0]
    else:
        return None


# from tornado
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号