pstr.py 文件源码

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

项目:MacHeap 作者: blankwall 项目源码 文件源码
def __init__(self, **attrs):
        res = super(string,self).__init__(**attrs)

        # ensure that self._object_ is using a fixed-width encoding
        _object_ = self._object_

        # encode 3 types of strings and ensure that their lengths scale up with their string sizes
        res,single,double = ( __builtin__.unicode(n, 'ascii').encode(_object_.encoding.name) for n in ('\x00', 'A', 'AA') )
        if len(res) * 2 == len(single) * 2 == len(double):
            return
        raise ValueError(self.classname(), 'string.__init__', 'User tried to specify a variable-width character encoding : {:s}'.format(_object_.encoding.name))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号