def __new__(self, name, cls, typedict): d = dict( size = _rawffi.sizeof('P'), align = _rawffi.alignment('P'), length = 1, _ffiargshape_ = 'P', _ffishape_ = 'P', _fficompositesize_ = None, ) # XXX check if typedict['_type_'] is any sane # XXX remember about paramfunc obj = type.__new__(self, name, cls, typedict) for k, v in d.iteritems(): setattr(obj, k, v) if '_type_' in typedict: self.set_type(obj, typedict['_type_']) else: def __init__(self, value=None): raise TypeError("%s has no type" % obj) obj.__init__ = __init__ return obj
def _alignmentofinstances(self): return _rawffi.alignment('P')
def test_sizes_and_alignments(self): import _rawffi for k, (s, a) in self.sizes_and_alignments.iteritems(): print k, s, a assert _rawffi.sizeof(k) == s assert _rawffi.alignment(k) == a
def _alignmentofinstances(self): return _rawffi.alignment(self._type_)
def test_sizes_and_alignments(self): import _rawffi for k, (s, a) in self.sizes_and_alignments.iteritems(): print k,s,a assert _rawffi.sizeof(k) == s assert _rawffi.alignment(k) == a