def extra_ivars(cls, base):
c_type = c_typeobj(cls)
c_base = c_typeobj(base)
t_size = c_type.tp_basicsize
b_size = c_base.tp_basicsize
sizeof_pyobj = ctypes.sizeof(ctypes.py_object)
if c_type.tp_itemsize or c_base.tp_itemsize:
return t_size != b_size or c_type.tp_itemsize != c_base.tp_itemsize
if is_heap_type(cls):
if c_type.tp_weaklistoffset and c_base.tp_weaklistoffset == 0:
if c_type.tp_weaklistoffset + sizeof_pyobj == t_size:
t_size -= sizeof_pyobj
if c_type.tp_dictoffset and c_base.tp_dictoffset == 0:
if c_type.tp_dictoffset + sizeof_pyobj == t_size:
t_size -= sizeof_pyobj
return t_size != b_size
python类sizeof()的实例源码
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
####################################################################################
#
# SDDS Payload Containers
#
####################################################################################
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def set_data(self, samples ):
if type(samples) == list:
for i,x in enumerate(samples):
if i < sdds_cb_payload.NUM_SAMPLES:
self.data[i] = x
else:
fit = min(len(samples), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), samples, fit)
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def set_data(self, samples ):
if type(samples) == list:
for i,x in enumerate(samples):
if i < sdds_si_payload.NUM_SAMPLES:
self.data[i] = x
else:
fit = min(len(samples), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), samples, fit)
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def set_data(self, samples ):
if type(samples) == list:
for i,x in enumerate(samples):
if i < sdds_sn_payload.NUM_SAMPLES:
self.data[i] = x
else:
fit = min(len(samples), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), samples, fit)
def asString(self):
return ctypes.string_at(ctypes.addressof(self),ctypes.sizeof(self))
def set_data(self, samples ):
if type(samples) == list:
for i,x in enumerate(samples):
if i < sdds_sf_payload.NUM_SAMPLES:
self.data[i] = x
else:
fit = min(len(samples), ctypes.sizeof(self))
ctypes.memmove(ctypes.addressof(self), samples, fit)