def __get__(self, obj, klass):
if obj is None:
return self
elif obj.none_bitmap & self.mask:
return None
if cython.compiled:
pybuf = cython.address(obj.pybuf)
buflen = pybuf.len
assert (obj.offs + self.offs + cython.sizeof(cython.longlong)) <= buflen
offs = obj.offs + cython.cast(cython.p_longlong,
cython.cast(cython.p_uchar, pybuf.buf) + obj.offs + self.offs)[0]
if obj.idmap is not None:
poffs = offs # python version of offs
rv = obj.idmap.get(poffs, poffs) # idmap cannot possibly hold "poffs" for that offset
if rv is not poffs:
return rv
assert offs + cython.sizeof(cython.ushort) <= buflen
else:
poffs = offs = obj.offs + struct.unpack_from('q', obj.buf, obj.offs + self.offs)[0]
rv = self.typ.unpack_from(obj.buf, offs)
if obj.idmap is not None:
obj.idmap[poffs] = rv
return rv
评论列表
文章目录