Python builtins 模块,PermissionError() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用builtins.PermissionError()

项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def addWriter(self, writer):
        if writer in self._writers.keys() or \
           writer in self._continuousPolling._writers:
            return

        fd = writer.fileno()
        try:
            self._asyncioEventloop.add_writer(fd, callWithLogger, writer,
                                              self._readOrWrite, writer,
                                              False)
            self._writers[writer] = fd
        except PermissionError:
            self._unregisterFDInAsyncio(fd)
            # epoll(7) doesn't support certain file descriptors,
            # e.g. filesystem files, so for those we just poll
            # continuously:
            self._continuousPolling.addWriter(writer)
        except BrokenPipeError:
            # The kqueuereactor will raise this if there is a broken pipe
            self._unregisterFDInAsyncio(fd)
        except:
            self._unregisterFDInAsyncio(fd)
            raise