subexprs = []
def analyse_types(self, env):
+ # we may have incorrectly interpreted a dotted name as a type rather than an attribute
+ # this could be better handled by more uniformly treating types as runtime-available objects
+ if self.base_type.module_path:
+ path = self.base_type.module_path
+ obj = env.lookup(path[0])
+ if obj.as_module is None:
+ operand = NameNode(pos=self.pos, name=path[0])
+ for attr in path[1:]:
+ operand = AttributeNode(pos=self.pos, obj=operand, attribute=attr)
+ operand = AttributeNode(pos=self.pos, obj=operand, attribute=self.base_type.name)
+ self.operand = operand
+ self.__class__ = SizeofVarNode
+ self.analyse_types(env)
+ return
base_type = self.base_type.analyse(env)
_, arg_type = self.declarator.analyse(base_type, env)
self.arg_type = arg_type
--- /dev/null
+cdef extern from "Python.h":
+ ctypedef struct PyTypeObject:
+ pass
+
+ ctypedef struct PyObject:
+ Py_ssize_t ob_refcnt
+ PyTypeObject *ob_type
+
+cdef extern from "longintrepr.h":
+ cdef struct _longobject:
+ int ob_refcnt
+ PyTypeObject *ob_type
+ int ob_size
+ unsigned int *ob_digit
+
+def test(temp = long(0)):
+ cdef _longobject *l
+ l = <_longobject *> temp
+ print sizeof(l.ob_size)
+ print sizeof(l.ob_digit[0])