unix_console.py 文件源码

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

项目:pefile.pypy 作者: cloudtracer 项目源码 文件源码
def push_char(self, char):
        self.partial_char += char
        try:
            c = unicode(self.partial_char, self.encoding)
        except UnicodeError, e:
            if len(e.args) > 4 and \
                   e.args[4] == 'unexpected end of data':
                pass
            else:
                # was: "raise".  But it crashes pyrepl, and by extension the
                # pypy currently running, in which we are e.g. in the middle
                # of some debugging session.  Argh.  Instead just print an
                # error message to stderr and continue running, for now.
                self.partial_char = ''
                sys.stderr.write('\n%s: %s\n' % (e.__class__.__name__, e))
        else:
            self.partial_char = ''
            self.event_queue.push(c)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号