Commits

Brian Kearns  committed 4d22842 Merge

merge fix-tpname

  • Participants
  • Parent commits 6066ed1, d307272

Comments (0)

Files changed (42)

File pypy/interpreter/astcompiler/ast.py

     for field, w_value in kwargs_w.iteritems():
         space.setattr(w_self, space.wrap(field), w_value)
 
-AST.typedef = typedef.TypeDef("AST",
+AST.typedef = typedef.TypeDef("_ast.AST",
     _fields=_FieldsWrapper([]),
     _attributes=_FieldsWrapper([]),
-    __module__='_ast',
     __reduce__=interp2app(AST.reduce_w),
     __setstate__=interp2app(AST.setstate_w),
     __dict__ = typedef.GetSetProperty(typedef.descr_get_dict,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(mod)),
 )
+mod.typedef.heaptype = True
 
 def Module_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     __new__=interp2app(get_AST_new(Module)),
     __init__=interp2app(Module_init),
 )
+Module.typedef.heaptype = True
 
 def Interactive_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     __new__=interp2app(get_AST_new(Interactive)),
     __init__=interp2app(Interactive_init),
 )
+Interactive.typedef.heaptype = True
 
 def Expression_get_body(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Expression)),
     __init__=interp2app(Expression_init),
 )
+Expression.typedef.heaptype = True
 
 def Suite_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     __new__=interp2app(get_AST_new(Suite)),
     __init__=interp2app(Suite_init),
 )
+Suite.typedef.heaptype = True
 
 def stmt_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     col_offset=typedef.GetSetProperty(stmt_get_col_offset, stmt_set_col_offset, stmt_del_col_offset, cls=stmt),
     __new__=interp2app(get_AST_new(stmt)),
 )
+stmt.typedef.heaptype = True
 
 def FunctionDef_get_name(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(FunctionDef)),
     __init__=interp2app(FunctionDef_init),
 )
+FunctionDef.typedef.heaptype = True
 
 def ClassDef_get_name(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(ClassDef)),
     __init__=interp2app(ClassDef_init),
 )
+ClassDef.typedef.heaptype = True
 
 def Return_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Return)),
     __init__=interp2app(Return_init),
 )
+Return.typedef.heaptype = True
 
 def Delete_get_targets(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Delete)),
     __init__=interp2app(Delete_init),
 )
+Delete.typedef.heaptype = True
 
 def Assign_get_targets(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Assign)),
     __init__=interp2app(Assign_init),
 )
+Assign.typedef.heaptype = True
 
 def AugAssign_get_target(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(AugAssign)),
     __init__=interp2app(AugAssign_init),
 )
+AugAssign.typedef.heaptype = True
 
 def Print_get_dest(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Print)),
     __init__=interp2app(Print_init),
 )
+Print.typedef.heaptype = True
 
 def For_get_target(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(For)),
     __init__=interp2app(For_init),
 )
+For.typedef.heaptype = True
 
 def While_get_test(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(While)),
     __init__=interp2app(While_init),
 )
+While.typedef.heaptype = True
 
 def If_get_test(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(If)),
     __init__=interp2app(If_init),
 )
+If.typedef.heaptype = True
 
 def With_get_context_expr(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(With)),
     __init__=interp2app(With_init),
 )
+With.typedef.heaptype = True
 
 def Raise_get_type(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Raise)),
     __init__=interp2app(Raise_init),
 )
+Raise.typedef.heaptype = True
 
 def TryExcept_get_body(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(TryExcept)),
     __init__=interp2app(TryExcept_init),
 )
+TryExcept.typedef.heaptype = True
 
 def TryFinally_get_body(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(TryFinally)),
     __init__=interp2app(TryFinally_init),
 )
+TryFinally.typedef.heaptype = True
 
 def Assert_get_test(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Assert)),
     __init__=interp2app(Assert_init),
 )
+Assert.typedef.heaptype = True
 
 def Import_get_names(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Import)),
     __init__=interp2app(Import_init),
 )
+Import.typedef.heaptype = True
 
 def ImportFrom_get_module(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(ImportFrom)),
     __init__=interp2app(ImportFrom_init),
 )
+ImportFrom.typedef.heaptype = True
 
 def Exec_get_body(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Exec)),
     __init__=interp2app(Exec_init),
 )
+Exec.typedef.heaptype = True
 
 def Global_get_names(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Global)),
     __init__=interp2app(Global_init),
 )
+Global.typedef.heaptype = True
 
 def Expr_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Expr)),
     __init__=interp2app(Expr_init),
 )
+Expr.typedef.heaptype = True
 
 def Pass_init(space, w_self, __args__):
     w_self = space.descr_self_interp_w(Pass, w_self)
     __new__=interp2app(get_AST_new(Pass)),
     __init__=interp2app(Pass_init),
 )
+Pass.typedef.heaptype = True
 
 def Break_init(space, w_self, __args__):
     w_self = space.descr_self_interp_w(Break, w_self)
     __new__=interp2app(get_AST_new(Break)),
     __init__=interp2app(Break_init),
 )
+Break.typedef.heaptype = True
 
 def Continue_init(space, w_self, __args__):
     w_self = space.descr_self_interp_w(Continue, w_self)
     __new__=interp2app(get_AST_new(Continue)),
     __init__=interp2app(Continue_init),
 )
+Continue.typedef.heaptype = True
 
 def expr_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     col_offset=typedef.GetSetProperty(expr_get_col_offset, expr_set_col_offset, expr_del_col_offset, cls=expr),
     __new__=interp2app(get_AST_new(expr)),
 )
+expr.typedef.heaptype = True
 
 def BoolOp_get_op(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(BoolOp)),
     __init__=interp2app(BoolOp_init),
 )
+BoolOp.typedef.heaptype = True
 
 def BinOp_get_left(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(BinOp)),
     __init__=interp2app(BinOp_init),
 )
+BinOp.typedef.heaptype = True
 
 def UnaryOp_get_op(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(UnaryOp)),
     __init__=interp2app(UnaryOp_init),
 )
+UnaryOp.typedef.heaptype = True
 
 def Lambda_get_args(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Lambda)),
     __init__=interp2app(Lambda_init),
 )
+Lambda.typedef.heaptype = True
 
 def IfExp_get_test(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(IfExp)),
     __init__=interp2app(IfExp_init),
 )
+IfExp.typedef.heaptype = True
 
 def Dict_get_keys(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Dict)),
     __init__=interp2app(Dict_init),
 )
+Dict.typedef.heaptype = True
 
 def Set_get_elts(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Set)),
     __init__=interp2app(Set_init),
 )
+Set.typedef.heaptype = True
 
 def ListComp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(ListComp)),
     __init__=interp2app(ListComp_init),
 )
+ListComp.typedef.heaptype = True
 
 def SetComp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(SetComp)),
     __init__=interp2app(SetComp_init),
 )
+SetComp.typedef.heaptype = True
 
 def DictComp_get_key(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(DictComp)),
     __init__=interp2app(DictComp_init),
 )
+DictComp.typedef.heaptype = True
 
 def GeneratorExp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(GeneratorExp)),
     __init__=interp2app(GeneratorExp_init),
 )
+GeneratorExp.typedef.heaptype = True
 
 def Yield_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Yield)),
     __init__=interp2app(Yield_init),
 )
+Yield.typedef.heaptype = True
 
 def Compare_get_left(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Compare)),
     __init__=interp2app(Compare_init),
 )
+Compare.typedef.heaptype = True
 
 def Call_get_func(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Call)),
     __init__=interp2app(Call_init),
 )
+Call.typedef.heaptype = True
 
 def Repr_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Repr)),
     __init__=interp2app(Repr_init),
 )
+Repr.typedef.heaptype = True
 
 def Num_get_n(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Num)),
     __init__=interp2app(Num_init),
 )
+Num.typedef.heaptype = True
 
 def Str_get_s(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Str)),
     __init__=interp2app(Str_init),
 )
+Str.typedef.heaptype = True
 
 def Attribute_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Attribute)),
     __init__=interp2app(Attribute_init),
 )
+Attribute.typedef.heaptype = True
 
 def Subscript_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Subscript)),
     __init__=interp2app(Subscript_init),
 )
+Subscript.typedef.heaptype = True
 
 def Name_get_id(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Name)),
     __init__=interp2app(Name_init),
 )
+Name.typedef.heaptype = True
 
 def List_get_elts(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(List)),
     __init__=interp2app(List_init),
 )
+List.typedef.heaptype = True
 
 def Tuple_get_elts(space, w_self):
     if not w_self.initialization_state & 4:
     __new__=interp2app(get_AST_new(Tuple)),
     __init__=interp2app(Tuple_init),
 )
+Tuple.typedef.heaptype = True
 
 def Const_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Const)),
     __init__=interp2app(Const_init),
 )
+Const.typedef.heaptype = True
 
 expr_context.typedef = typedef.TypeDef("expr_context",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(expr_context)),
 )
+expr_context.typedef.heaptype = True
 
 _Load.typedef = typedef.TypeDef("Load",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Load)),
 )
+_Load.typedef.heaptype = True
 
 _Store.typedef = typedef.TypeDef("Store",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Store)),
 )
+_Store.typedef.heaptype = True
 
 _Del.typedef = typedef.TypeDef("Del",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Del)),
 )
+_Del.typedef.heaptype = True
 
 _AugLoad.typedef = typedef.TypeDef("AugLoad",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_AugLoad)),
 )
+_AugLoad.typedef.heaptype = True
 
 _AugStore.typedef = typedef.TypeDef("AugStore",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_AugStore)),
 )
+_AugStore.typedef.heaptype = True
 
 _Param.typedef = typedef.TypeDef("Param",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Param)),
 )
+_Param.typedef.heaptype = True
 
 slice.typedef = typedef.TypeDef("slice",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(slice)),
 )
+slice.typedef.heaptype = True
 
 def Ellipsis_init(space, w_self, __args__):
     w_self = space.descr_self_interp_w(Ellipsis, w_self)
     __new__=interp2app(get_AST_new(Ellipsis)),
     __init__=interp2app(Ellipsis_init),
 )
+Ellipsis.typedef.heaptype = True
 
 def Slice_get_lower(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Slice)),
     __init__=interp2app(Slice_init),
 )
+Slice.typedef.heaptype = True
 
 def ExtSlice_get_dims(space, w_self):
     if not w_self.initialization_state & 1:
     __new__=interp2app(get_AST_new(ExtSlice)),
     __init__=interp2app(ExtSlice_init),
 )
+ExtSlice.typedef.heaptype = True
 
 def Index_get_value(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(Index)),
     __init__=interp2app(Index_init),
 )
+Index.typedef.heaptype = True
 
 boolop.typedef = typedef.TypeDef("boolop",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(boolop)),
 )
+boolop.typedef.heaptype = True
 
 _And.typedef = typedef.TypeDef("And",
     boolop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_And)),
 )
+_And.typedef.heaptype = True
 
 _Or.typedef = typedef.TypeDef("Or",
     boolop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Or)),
 )
+_Or.typedef.heaptype = True
 
 operator.typedef = typedef.TypeDef("operator",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(operator)),
 )
+operator.typedef.heaptype = True
 
 _Add.typedef = typedef.TypeDef("Add",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Add)),
 )
+_Add.typedef.heaptype = True
 
 _Sub.typedef = typedef.TypeDef("Sub",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Sub)),
 )
+_Sub.typedef.heaptype = True
 
 _Mult.typedef = typedef.TypeDef("Mult",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Mult)),
 )
+_Mult.typedef.heaptype = True
 
 _Div.typedef = typedef.TypeDef("Div",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Div)),
 )
+_Div.typedef.heaptype = True
 
 _Mod.typedef = typedef.TypeDef("Mod",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Mod)),
 )
+_Mod.typedef.heaptype = True
 
 _Pow.typedef = typedef.TypeDef("Pow",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Pow)),
 )
+_Pow.typedef.heaptype = True
 
 _LShift.typedef = typedef.TypeDef("LShift",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_LShift)),
 )
+_LShift.typedef.heaptype = True
 
 _RShift.typedef = typedef.TypeDef("RShift",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_RShift)),
 )
+_RShift.typedef.heaptype = True
 
 _BitOr.typedef = typedef.TypeDef("BitOr",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitOr)),
 )
+_BitOr.typedef.heaptype = True
 
 _BitXor.typedef = typedef.TypeDef("BitXor",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitXor)),
 )
+_BitXor.typedef.heaptype = True
 
 _BitAnd.typedef = typedef.TypeDef("BitAnd",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitAnd)),
 )
+_BitAnd.typedef.heaptype = True
 
 _FloorDiv.typedef = typedef.TypeDef("FloorDiv",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_FloorDiv)),
 )
+_FloorDiv.typedef.heaptype = True
 
 unaryop.typedef = typedef.TypeDef("unaryop",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(unaryop)),
 )
+unaryop.typedef.heaptype = True
 
 _Invert.typedef = typedef.TypeDef("Invert",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Invert)),
 )
+_Invert.typedef.heaptype = True
 
 _Not.typedef = typedef.TypeDef("Not",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Not)),
 )
+_Not.typedef.heaptype = True
 
 _UAdd.typedef = typedef.TypeDef("UAdd",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_UAdd)),
 )
+_UAdd.typedef.heaptype = True
 
 _USub.typedef = typedef.TypeDef("USub",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_USub)),
 )
+_USub.typedef.heaptype = True
 
 cmpop.typedef = typedef.TypeDef("cmpop",
     AST.typedef,
     _attributes=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(cmpop)),
 )
+cmpop.typedef.heaptype = True
 
 _Eq.typedef = typedef.TypeDef("Eq",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Eq)),
 )
+_Eq.typedef.heaptype = True
 
 _NotEq.typedef = typedef.TypeDef("NotEq",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_NotEq)),
 )
+_NotEq.typedef.heaptype = True
 
 _Lt.typedef = typedef.TypeDef("Lt",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Lt)),
 )
+_Lt.typedef.heaptype = True
 
 _LtE.typedef = typedef.TypeDef("LtE",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_LtE)),
 )
+_LtE.typedef.heaptype = True
 
 _Gt.typedef = typedef.TypeDef("Gt",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Gt)),
 )
+_Gt.typedef.heaptype = True
 
 _GtE.typedef = typedef.TypeDef("GtE",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_GtE)),
 )
+_GtE.typedef.heaptype = True
 
 _Is.typedef = typedef.TypeDef("Is",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Is)),
 )
+_Is.typedef.heaptype = True
 
 _IsNot.typedef = typedef.TypeDef("IsNot",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_IsNot)),
 )
+_IsNot.typedef.heaptype = True
 
 _In.typedef = typedef.TypeDef("In",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_In)),
 )
+_In.typedef.heaptype = True
 
 _NotIn.typedef = typedef.TypeDef("NotIn",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_NotIn)),
 )
+_NotIn.typedef.heaptype = True
 
 def comprehension_get_target(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(comprehension)),
     __init__=interp2app(comprehension_init),
 )
+comprehension.typedef.heaptype = True
 
 def excepthandler_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     col_offset=typedef.GetSetProperty(excepthandler_get_col_offset, excepthandler_set_col_offset, excepthandler_del_col_offset, cls=excepthandler),
     __new__=interp2app(get_AST_new(excepthandler)),
 )
+excepthandler.typedef.heaptype = True
 
 def ExceptHandler_get_type(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(ExceptHandler)),
     __init__=interp2app(ExceptHandler_init),
 )
+ExceptHandler.typedef.heaptype = True
 
 def arguments_get_args(space, w_self):
     if not w_self.initialization_state & 1:
     __new__=interp2app(get_AST_new(arguments)),
     __init__=interp2app(arguments_init),
 )
+arguments.typedef.heaptype = True
 
 def keyword_get_arg(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(keyword)),
     __init__=interp2app(keyword_init),
 )
+keyword.typedef.heaptype = True
 
 def alias_get_name(space, w_self):
     if w_self.w_dict is not None:
     __new__=interp2app(get_AST_new(alias)),
     __init__=interp2app(alias_init),
 )
-
+alias.typedef.heaptype = True
+

File pypy/interpreter/astcompiler/tools/asdl_py.py

         if needs_init:
             self.emit("__init__=interp2app(%s_init)," % (name,), 1)
         self.emit(")")
+        self.emit("%s.typedef.heaptype = True" % name)
         self.emit("")
 
     def make_init(self, name, fields):
     for field, w_value in kwargs_w.iteritems():
         space.setattr(w_self, space.wrap(field), w_value)
 
-AST.typedef = typedef.TypeDef("AST",
+AST.typedef = typedef.TypeDef("_ast.AST",
     _fields=_FieldsWrapper([]),
     _attributes=_FieldsWrapper([]),
-    __module__='_ast',
     __reduce__=interp2app(AST.reduce_w),
     __setstate__=interp2app(AST.setstate_w),
     __dict__ = typedef.GetSetProperty(typedef.descr_get_dict,

File pypy/interpreter/error.py

                     if fmt == 'R':
                         result = space.str_w(space.repr(value))
                     elif fmt == 'T':
-                        result = space.type(value).get_module_type_name()
+                        result = space.type(value).name
                     elif fmt == 'N':
                         result = value.getname(space)
                     else:
 
     %N - The result of w_arg.getname(space)
     %R - The result of space.str_w(space.repr(w_arg))
-    %T - The result of space.type(w_arg).get_module_type_name()
+    %T - The result of space.type(w_arg).name
 
     """
     if not len(args):

File pypy/interpreter/typedef.py

         else:
             bases = [__base]
         self.bases = bases
+        self.heaptype = False
         self.hasdict = '__dict__' in rawdict
         self.weakrefable = '__weakref__' in rawdict
         self.doc = rawdict.pop('__doc__', None)

File pypy/module/_ast/test/test_ast.py

         assert isinstance(ast.__version__, str)
 
     def test_flags(self):
-        skip("broken")
         from copy_reg import _HEAPTYPE
-        assert self.ast.Module.__flags__ & _HEAPTYPE
+        assert self.ast.AST.__flags__ & _HEAPTYPE == 0
+        assert self.ast.Module.__flags__ & _HEAPTYPE == _HEAPTYPE
 
     def test_build_ast(self):
         ast = self.ast
         x = ast.Num()
         assert x._fields == ('n',)
         exc = raises(AttributeError, getattr, x, 'n')
-        assert "Num' object has no attribute 'n'" in exc.value.args[0]
+        assert str(exc.value) == "'Num' object has no attribute 'n'"
 
         x = ast.Num(42)
         assert x.n == 42
         exc = raises(AttributeError, getattr, x, 'lineno')
-        assert "Num' object has no attribute 'lineno'" in exc.value.args[0]
+        assert str(exc.value) == "'Num' object has no attribute 'lineno'"
 
         y = ast.Num()
         x.lineno = y
         assert x.lineno == y
 
         exc = raises(AttributeError, getattr, x, 'foobar')
-        assert "Num' object has no attribute 'foobar'" in exc.value.args[0]
+        assert str(exc.value) == "'Num' object has no attribute 'foobar'"
 
         x = ast.Num(lineno=2)
         assert x.lineno == 2
 
     def test_issue1673_Num_fullinit(self):
         import ast
-        import copy 
+        import copy
         num_node = ast.Num(n=2,lineno=2,col_offset=3)
         num_node2 = copy.deepcopy(num_node)
         assert num_node.n == num_node2.n

File pypy/module/_cffi_backend/cbuffer.py

             raise
 
 MiniBuffer.typedef = TypeDef(
-    "buffer",
-    __module__ = "_cffi_backend",
+    "_cffi_backend.buffer",
     __len__ = interp2app(MiniBuffer.descr_len),
     __getitem__ = interp2app(MiniBuffer.descr_getitem),
     __setitem__ = interp2app(MiniBuffer.descr_setitem),

File pypy/module/_cffi_backend/cdataobj.py

 
 
 W_CData.typedef = TypeDef(
-    'CData',
+    '_cffi_backend.CData',
     __module__ = '_cffi_backend',
     __name__ = '<cdata>',
     __repr__ = interp2app(W_CData.repr),

File pypy/module/_cffi_backend/ctypearray.py

         return self.ctitem.convert_to_object(result)
 
 W_CDataIter.typedef = TypeDef(
-    'CDataIter',
-    __module__ = '_cffi_backend',
+    '_cffi_backend.CDataIter',
     __iter__ = interp2app(W_CDataIter.iter_w),
     next = interp2app(W_CDataIter.next_w),
     )

File pypy/module/_cffi_backend/ctypeobj.py

 
 
 W_CType.typedef = TypeDef(
-    'CTypeDescr',
-    __module__ = '_cffi_backend',
+    '_cffi_backend.CTypeDescr',
     __repr__ = interp2app(W_CType.repr),
     __weakref__ = make_weakref_descr(W_CType),
     kind = GetSetProperty(W_CType.fget_kind, doc="kind"),

File pypy/module/_cffi_backend/ctypestruct.py

 
 
 W_CField.typedef = TypeDef(
-    'CField',
-    __module__ = '_cffi_backend',
+    '_cffi_backend.CField',
     type = interp_attrproperty('ctype', W_CField),
     offset = interp_attrproperty('offset', W_CField),
     bitshift = interp_attrproperty('bitshift', W_CField),

File pypy/module/_cffi_backend/libraryobj.py

 
 
 W_Library.typedef = TypeDef(
-    'Library',
-    __module__ = '_cffi_backend',
+    '_cffi_backend.Library',
     __repr__ = interp2app(W_Library.repr),
     load_function = interp2app(W_Library.load_function),
     read_variable = interp2app(W_Library.read_variable),

File pypy/module/_collections/interp_deque.py

     W_Deque.__init__(space.interp_w(W_Deque, w_self), space)
     return w_self
 
-W_Deque.typedef = TypeDef("deque",
+W_Deque.typedef = TypeDef("collections.deque",
     __doc__ = """deque(iterable[, maxlen]) --> deque object
 
 Build an ordered collection accessible from endpoints only.""",
-    __module__ = '_collections',
     __new__ = interp2app(descr__new__),
     __init__ = interp2app(W_Deque.init),
     append     = interp2app(W_Deque.append),

File pypy/module/_collections/test/test_deque.py

 
     def test_basics(self):
         from _collections import deque
+        assert deque.__module__ == 'collections'
+
         d = deque(xrange(-5125, -5000))
         d.__init__(xrange(200))
         for i in xrange(200, 400):

File pypy/module/_continuation/interp_continuation.py

 
 
 W_Continulet.typedef = TypeDef(
-    'continulet',
-    __module__ = '_continuation',
+    '_continuation.continulet',
     __new__     = interp2app(W_Continulet___new__),
     __init__    = interp2app(W_Continulet.descr_init),
     switch      = interp2app(W_Continulet.descr_switch),

File pypy/module/_csv/interp_csv.py

 
 
 W_Dialect.typedef = TypeDef(
-        'Dialect',
-        __module__ = '_csv',
+        '_csv.Dialect',
         __new__ = interp2app(W_Dialect___new__),
 
         delimiter        = interp_attrproperty('delimiter', W_Dialect),

File pypy/module/_csv/interp_reader.py

     return W_Reader(space, dialect, w_iter)
 
 W_Reader.typedef = TypeDef(
-        'reader',
-        __module__ = '_csv',
+        '_csv.reader',
         dialect = interp_attrproperty_w('dialect', W_Reader),
         line_num = interp_attrproperty('line_num', W_Reader),
         __iter__ = interp2app(W_Reader.iter_w),

File pypy/module/_csv/interp_writer.py

     return W_Writer(space, dialect, w_fileobj)
 
 W_Writer.typedef = TypeDef(
-        'writer',
-        __module__ = '_csv',
+        '_csv.writer',
         dialect = interp_attrproperty_w('dialect', W_Writer),
         writerow = interp2app(W_Writer.writerow),
         writerows = interp2app(W_Writer.writerows),

File pypy/module/_io/interp_bufferedio.py

         return space.call_method(self.w_raw, "isatty")
 
     def repr_w(self, space):
-        typename = space.type(self).getname(space)
-        module = space.str_w(space.type(self).get_module())
+        typename = space.type(self).name
         try:
             w_name = space.getattr(self, space.wrap("name"))
         except OperationError, e:
             if not e.match(space, space.w_AttributeError):
                 raise
-            return space.wrap("<%s.%s>" % (module, typename,))
+            return space.wrap("<%s>" % (typename,))
         else:
             name_repr = space.str_w(space.repr(w_name))
-            return space.wrap("<%s.%s name=%s>" % (module, typename, name_repr))
+            return space.wrap("<%s name=%s>" % (typename, name_repr))
 
     # ______________________________________________
 
         self.state = STATE_OK
 
 W_BufferedReader.typedef = TypeDef(
-    'BufferedReader', W_BufferedIOBase.typedef,
+    '_io.BufferedReader', W_BufferedIOBase.typedef,
     __new__ = generic_new_descr(W_BufferedReader),
     __init__  = interp2app(W_BufferedReader.descr_init),
-    __module__ = "_io",
 
     read = interp2app(W_BufferedReader.read_w),
     peek = interp2app(W_BufferedReader.peek_w),
         self.state = STATE_OK
 
 W_BufferedWriter.typedef = TypeDef(
-    'BufferedWriter', W_BufferedIOBase.typedef,
+    '_io.BufferedWriter', W_BufferedIOBase.typedef,
     __new__ = generic_new_descr(W_BufferedWriter),
     __init__  = interp2app(W_BufferedWriter.descr_init),
-    __module__ = "_io",
 
     write = interp2app(W_BufferedWriter.write_w),
     flush = interp2app(W_BufferedWriter.flush_w),
         self.state = STATE_OK
 
 W_BufferedRandom.typedef = TypeDef(
-    'BufferedRandom', W_BufferedIOBase.typedef,
+    '_io.BufferedRandom', W_BufferedIOBase.typedef,
     __new__ = generic_new_descr(W_BufferedRandom),
     __init__ = interp2app(W_BufferedRandom.descr_init),
-    __module__ = "_io",
 
     read = interp2app(W_BufferedRandom.read_w),
     peek = interp2app(W_BufferedRandom.peek_w),

File pypy/module/_io/interp_stringio.py

 
 
 W_StringIO.typedef = TypeDef(
-    'StringIO', W_TextIOBase.typedef,
-    __module__ = "_io",
+    '_io.StringIO', W_TextIOBase.typedef,
     __new__  = generic_new_descr(W_StringIO),
     __init__ = interp2app(W_StringIO.descr_init),
     __getstate__ = interp2app(W_StringIO.descr_getstate),

File pypy/module/_io/interp_textio.py

         self.chunk_size = size
 
 W_TextIOWrapper.typedef = TypeDef(
-    'TextIOWrapper', W_TextIOBase.typedef,
+    '_io.TextIOWrapper', W_TextIOBase.typedef,
     __new__ = generic_new_descr(W_TextIOWrapper),
     __init__  = interp2app(W_TextIOWrapper.descr_init),
     __repr__ = interp2app(W_TextIOWrapper.descr_repr),
-    __module__ = "_io",
 
     next = interp2app(W_TextIOWrapper.next_w),
     read = interp2app(W_TextIOWrapper.read_w),

File pypy/module/_lsprof/interp_lsprof.py

         if isinstance(w_type, W_TypeObject):
             w_realclass, _ = space.lookup_in_type_where(w_type, name)
             if isinstance(w_realclass, W_TypeObject):
-                class_name = w_realclass.get_module_type_name()
+                class_name = w_realclass.name
     else:
         name = '?'
     if class_name is None:
     return space.wrap(p)
 
 W_Profiler.typedef = TypeDef(
-    'Profiler',
-    __module__ = '_lsprof',
+    '_lsprof.Profiler',
     __new__ = interp2app(descr_new_profile),
     enable = interp2app(W_Profiler.enable),
     disable = interp2app(W_Profiler.disable),

File pypy/module/_multibytecodec/interp_incremental.py

 
 MultibyteIncrementalDecoder.typedef = TypeDef(
     'MultibyteIncrementalDecoder',
-    __module__ = '_multibytecodec',
     __new__ = interp2app(mbidecoder_new),
     decode  = interp2app(MultibyteIncrementalDecoder.decode_w),
     reset   = interp2app(MultibyteIncrementalDecoder.reset_w),
 
 MultibyteIncrementalEncoder.typedef = TypeDef(
     'MultibyteIncrementalEncoder',
-    __module__ = '_multibytecodec',
     __new__ = interp2app(mbiencoder_new),
     encode  = interp2app(MultibyteIncrementalEncoder.encode_w),
     reset   = interp2app(MultibyteIncrementalEncoder.reset_w),

File pypy/module/_multibytecodec/interp_multibytecodec.py

 
 MultibyteCodec.typedef = TypeDef(
     'MultibyteCodec',
-    __module__ = '_multibytecodec',
     decode = interp2app(MultibyteCodec.decode),
     encode = interp2app(MultibyteCodec.encode),
     )

File pypy/module/_multiprocessing/interp_connection.py

         return bool(r)
 
 W_FileConnection.typedef = TypeDef(
-    'Connection', W_BaseConnection.typedef,
+    '_multiprocessing.Connection', W_BaseConnection.typedef,
     __new__ = interp2app(W_FileConnection.descr_new_file.im_func),
-    __module__ = '_multiprocessing',
     fileno = interp2app(W_FileConnection.fileno),
 )
 
 
 if sys.platform == 'win32':
     W_PipeConnection.typedef = TypeDef(
-        'PipeConnection', W_BaseConnection.typedef,
+        '_multiprocessing.PipeConnection', W_BaseConnection.typedef,
         __new__ = interp2app(W_PipeConnection.descr_new_pipe.im_func),
-        __module__ = '_multiprocessing',
         fileno = interp2app(W_PipeConnection.fileno),
     )

File pypy/module/_socket/interp_socket.py

     method = getattr(W_RSocket, methodname + '_w')
     socketmethods[methodname] = interp2app(method)
 
-W_RSocket.typedef = TypeDef("socket",
-    __module__ = "_socket",
+W_RSocket.typedef = TypeDef("_socket.socket",
     __doc__ = """\
 socket([family[, type[, proto]]]) -> socket object
 

File pypy/module/array/interp_array.py

             return space.wrap(s)
 
 W_ArrayBase.typedef = TypeDef(
-    'array',
+    'array.array',
     __new__ = interp2app(w_array),
-    __module__ = 'array',
 
     __len__ = interp2app(W_ArrayBase.descr_len),
     __eq__ = interp2app(W_ArrayBase.descr_eq),

File pypy/module/cpyext/methodobject.py

 from pypy.interpreter.gateway import interp2app
 from pypy.interpreter.typedef import (
     GetSetProperty, TypeDef, interp_attrproperty, interp_attrproperty_w)
+from pypy.objspace.std.typeobject import W_TypeObject
 from pypy.module.cpyext.api import (
     CONST_STRING, METH_CLASS, METH_COEXIST, METH_KEYWORDS, METH_NOARGS, METH_O,
     METH_STATIC, METH_VARARGS, PyObject, PyObjectFields, bootstrap_function,
         self.doc = doc
         self.func = func
         pyo = rffi.cast(PyObject, pto)
-        self.w_objclass = from_ref(space, pyo)
+        w_type = from_ref(space, pyo)
+        assert isinstance(w_type, W_TypeObject)
+        self.w_objclass = w_type
 
     def call(self, space, w_self, w_args, w_kw):
         if self.wrapper_func is None:
     def descr_method_repr(self):
         return self.space.wrap("<slot wrapper '%s' of '%s' objects>" %
                                (self.method_name,
-                                self.w_objclass.getname(self.space)))
+                                self.w_objclass.name))
 
 def cwrapper_descr_call(space, w_self, __args__):
     self = space.interp_w(W_PyCWrapperObject, w_self)

File pypy/module/cpyext/test/test_typeobject.py

         assert "copy" in repr(module.fooType.copy)
         assert repr(module.fooType) == "<type 'foo.foo'>"
         assert repr(obj2) == "<Foo>"
-        assert repr(module.fooType.__call__) == "<slot wrapper '__call__' of 'foo' objects>"
+        assert repr(module.fooType.__call__) == "<slot wrapper '__call__' of 'foo.foo' objects>"
         assert obj2(foo=1, bar=2) == dict(foo=1, bar=2)
 
         print(obj.foo)

File pypy/module/cpyext/typeobject.py

         convert_getset_defs(space, dict_w, pto.c_tp_getset, self)
         convert_member_defs(space, dict_w, pto.c_tp_members, self)
 
-        full_name = rffi.charp2str(pto.c_tp_name)
-        if '.' in full_name:
-            module_name, extension_name = rsplit(full_name, ".", 1)
-            dict_w["__module__"] = space.wrap(module_name)
-        else:
-            extension_name = full_name
+        name = rffi.charp2str(pto.c_tp_name)
 
-        W_TypeObject.__init__(self, space, extension_name,
+        W_TypeObject.__init__(self, space, name,
             bases_w or [space.w_object], dict_w)
         if not space.is_true(space.issubtype(self, space.w_type)):
             self.flag_cpytype = True
         from pypy.module.cpyext.stringobject import PyString_AsString
         pto.c_tp_name = PyString_AsString(space, heaptype.c_ht_name)
     else:
-        pto.c_tp_name = rffi.str2charp(w_type.getname(space))
+        pto.c_tp_name = rffi.str2charp(w_type.name)
     pto.c_tp_basicsize = -1 # hopefully this makes malloc bail out
     pto.c_tp_itemsize = 0
     # uninitialized fields:

File pypy/module/exceptions/interp_exceptions.py

     return interp2app(descr_new_base_exception)
 
 W_BaseException.typedef = TypeDef(
-    'BaseException',
+    'exceptions.BaseException',
     __doc__ = W_BaseException.__doc__,
-    __module__ = 'exceptions',
     __new__ = _new(W_BaseException),
     __init__ = interp2app(W_BaseException.descr_init),
     __str__ = interp2app(W_BaseException.descr_str),
     for k, v in kwargs.items():
         kwargs[k] = interp2app(v.__get__(None, realbase))
     W_Exc.typedef = TypeDef(
-        name,
+        'exceptions.' + name,
         base.typedef,
         __doc__ = W_Exc.__doc__,
-        __module__ = 'exceptions',
         **kwargs
     )
     W_Exc.typedef.applevel_subclasses_base = realbase
         """)
 
 W_UnicodeTranslateError.typedef = TypeDef(
-    'UnicodeTranslateError',
+    'exceptions.UnicodeTranslateError',
     W_UnicodeError.typedef,
     __doc__ = W_UnicodeTranslateError.__doc__,
-    __module__ = 'exceptions',
     __new__ = _new(W_UnicodeTranslateError),
     __init__ = interp2app(W_UnicodeTranslateError.descr_init),
     __str__ = interp2app(W_UnicodeTranslateError.descr_str),
         return W_BaseException.descr_str(self, space)
 
 W_EnvironmentError.typedef = TypeDef(
-    'EnvironmentError',
+    'exceptions.EnvironmentError',
     W_StandardError.typedef,
     __doc__ = W_EnvironmentError.__doc__,
-    __module__ = 'exceptions',
     __new__ = _new(W_EnvironmentError),
     __reduce__ = interp2app(W_EnvironmentError.descr_reduce),
     __init__ = interp2app(W_EnvironmentError.descr_init),
         _winerror_to_errno, _default_errno = {}, 22 # EINVAL
 
 W_WindowsError.typedef = TypeDef(
-    "WindowsError",
+    "exceptions.WindowsError",
     W_OSError.typedef,
     __doc__  = W_WindowsError.__doc__,
-    __module__ = 'exceptions',
     __new__  = _new(W_WindowsError),
     __init__ = interp2app(W_WindowsError.descr_init),
     __str__  = interp2app(W_WindowsError.descr_str),
             return W_StandardError.descr_repr(self, space)
 
 W_SyntaxError.typedef = TypeDef(
-    'SyntaxError',
+    'exceptions.SyntaxError',
     W_StandardError.typedef,
     __new__ = _new(W_SyntaxError),
     __init__ = interp2app(W_SyntaxError.descr_init),
     __str__ = interp2app(W_SyntaxError.descr_str),
     __repr__ = interp2app(W_SyntaxError.descr_repr),
     __doc__ = W_SyntaxError.__doc__,
-    __module__ = 'exceptions',
     msg      = readwrite_attrproperty_w('w_msg', W_SyntaxError),
     filename = readwrite_attrproperty_w('w_filename', W_SyntaxError),
     lineno   = readwrite_attrproperty_w('w_lineno', W_SyntaxError),
         W_BaseException.descr_init(self, space, args_w)
 
 W_SystemExit.typedef = TypeDef(
-    'SystemExit',
+    'exceptions.SystemExit',
     W_BaseException.typedef,
     __new__ = _new(W_SystemExit),
     __init__ = interp2app(W_SystemExit.descr_init),
     __doc__ = W_SystemExit.__doc__,
-    __module__ = 'exceptions',
     code    = readwrite_attrproperty_w('w_code', W_SystemExit)
 )
 
         """)
 
 W_UnicodeDecodeError.typedef = TypeDef(
-    'UnicodeDecodeError',
+    'exceptions.UnicodeDecodeError',
     W_UnicodeError.typedef,
     __doc__ = W_UnicodeDecodeError.__doc__,
-    __module__ = 'exceptions',
     __new__ = _new(W_UnicodeDecodeError),
     __init__ = interp2app(W_UnicodeDecodeError.descr_init),
     __str__ = interp2app(W_UnicodeDecodeError.descr_str),
         """)
 
 W_UnicodeEncodeError.typedef = TypeDef(
-    'UnicodeEncodeError',
+    'exceptions.UnicodeEncodeError',
     W_UnicodeError.typedef,
     __doc__ = W_UnicodeEncodeError.__doc__,
-    __module__ = 'exceptions',
     __new__ = _new(W_UnicodeEncodeError),
     __init__ = interp2app(W_UnicodeEncodeError.descr_init),
     __str__ = interp2app(W_UnicodeEncodeError.descr_str),

File pypy/module/itertools/interp_itertools.py

     return space.wrap(r)
 
 W_Count.typedef = TypeDef(
-        'count',
-        __module__ = 'itertools',
+        'itertools.count',
         __new__ = interp2app(W_Count___new__),
         __iter__ = interp2app(W_Count.iter_w),
         next = interp2app(W_Count.next_w),
     return space.wrap(r)
 
 W_Repeat.typedef = TypeDef(
-        'repeat',
-        __module__ = 'itertools',
+        'itertools.repeat',
         __new__          = interp2app(W_Repeat___new__),
         __iter__         = interp2app(W_Repeat.iter_w),
         __length_hint__  = interp2app(W_Repeat.length_w),
 
 
 W_TakeWhile.typedef = TypeDef(
-        'takewhile',
-        __module__ = 'itertools',
+        'itertools.takewhile',
         __new__  = interp2app(W_TakeWhile___new__),
         __iter__ = interp2app(W_TakeWhile.iter_w),
         next     = interp2app(W_TakeWhile.next_w),
 
 
 W_DropWhile.typedef = TypeDef(
-        'dropwhile',
-        __module__ = 'itertools',
+        'itertools.dropwhile',
         __new__  = interp2app(W_DropWhile___new__),
         __iter__ = interp2app(W_DropWhile.iter_w),
         next     = interp2app(W_DropWhile.next_w),
     return space.wrap(r)
 
 W_IFilter.typedef = TypeDef(
-        'ifilter',
-        __module__ = 'itertools',
+        'itertools.ifilter',
         __new__  = interp2app(W_IFilter___new__),
         __iter__ = interp2app(W_IFilter.iter_w),
         next     = interp2app(W_IFilter.next_w),
     return space.wrap(r)
 
 W_IFilterFalse.typedef = TypeDef(
-        'ifilterfalse',
-        __module__ = 'itertools',
+        'itertools.ifilterfalse',
         __new__  = interp2app(W_IFilterFalse___new__),
         __iter__ = interp2app(W_IFilterFalse.iter_w),
         next     = interp2app(W_IFilterFalse.next_w),
     return space.wrap(r)
 
 W_ISlice.typedef = TypeDef(
-        'islice',
-        __module__ = 'itertools',
+        'itertools.islice',
         __new__  = interp2app(W_ISlice___new__),
         __iter__ = interp2app(W_ISlice.iter_w),
         next     = interp2app(W_ISlice.next_w),
     return space.wrap(r)
 
 W_Chain.typedef = TypeDef(
-        'chain',
-        __module__ = 'itertools',
+        'itertools.chain',
         __new__  = interp2app(W_Chain___new__),
         __iter__ = interp2app(W_Chain.iter_w),
         next     = interp2app(W_Chain.next_w),
     return space.wrap(r)
 
 W_IMap.typedef = TypeDef(
-        'imap',
-        __module__ = 'itertools',
+        'itertools.imap',
         __new__  = interp2app(W_IMap___new__),
         __iter__ = interp2app(W_IMap.iter_w),
         next     = interp2app(W_IMap.next_w),
     return space.wrap(r)
 
 W_IZip.typedef = TypeDef(
-        'izip',
-        __module__ = 'itertools',
+        'itertools.izip',
         __new__  = interp2app(W_IZip___new__),
         __iter__ = interp2app(W_IZip.iter_w),
         next     = interp2app(W_IZip.next_w),
     return space.wrap(self)
 
 W_IZipLongest.typedef = TypeDef(
-        'izip_longest',
-        __module__ = 'itertools',
+        'itertools.izip_longest',
         __new__  = interp2app(W_IZipLongest___new__),
         __iter__ = interp2app(W_IZipLongest.iter_w),
         next     = interp2app(W_IZipLongest.next_w),
     return space.wrap(r)
 
 W_Cycle.typedef = TypeDef(
-        'cycle',
-        __module__ = 'itertools',
+        'itertools.cycle',
         __new__  = interp2app(W_Cycle___new__),
         __iter__ = interp2app(W_Cycle.iter_w),
         next     = interp2app(W_Cycle.next_w),
     return space.wrap(r)
 
 W_StarMap.typedef = TypeDef(
-        'starmap',
-        __module__ = 'itertools',
+        'itertools.starmap',
         __new__  = interp2app(W_StarMap___new__),
         __iter__ = interp2app(W_StarMap.iter_w),
         next     = interp2app(W_StarMap.next_w),
                                            myiter.chained_list))
 
 W_TeeIterable.typedef = TypeDef(
-        '_tee',
-        __module__ = 'itertools',
+        'itertools._tee',
         __new__ = interp2app(W_TeeIterable___new__),
         __iter__ = interp2app(W_TeeIterable.iter_w),
         next     = interp2app(W_TeeIterable.next_w),
     return space.wrap(r)
 
 W_GroupBy.typedef = TypeDef(
-        'groupby',
-        __module__ = 'itertools',
+        'itertools.groupby',
         __new__  = interp2app(W_GroupBy___new__),
         __iter__ = interp2app(W_GroupBy.iter_w),
         next     = interp2app(W_GroupBy.next_w),
             return w_obj
 
 W_GroupByIterator.typedef = TypeDef(
-        '_groupby',
-        __module__ = 'itertools',
+        'itertools._groupby',
         __iter__ = interp2app(W_GroupByIterator.iter_w),
         next     = interp2app(W_GroupByIterator.next_w))
 W_GroupByIterator.typedef.acceptable_as_base_class = False
     return space.wrap(r)
 
 W_Compress.typedef = TypeDef(
-    'compress',
-    __module__ = 'itertools',
+    'itertools.compress',
     __new__ = interp2app(W_Compress__new__),
     __iter__ = interp2app(W_Compress.iter_w),
     next     = interp2app(W_Compress.next_w),
     return space.wrap(r)
 
 W_Product.typedef = TypeDef(
-    'product',
-    __module__ = 'itertools',
+    'itertools.product',
     __new__ = interp2app(W_Product__new__),
     __iter__ = interp2app(W_Product.iter_w),
     next = interp2app(W_Product.next_w),
     res.__init__(space, pool_w, indices, r)
     return space.wrap(res)
 
-W_Combinations.typedef = TypeDef("combinations",
-    __module__ = 'itertools',
+W_Combinations.typedef = TypeDef("itertools.combinations",
     __new__ = interp2app(W_Combinations__new__),
     __iter__ = interp2app(W_Combinations.descr__iter__),
     next = interp2app(W_Combinations.descr_next),
     res.__init__(space, pool_w, indices, r)
     return space.wrap(res)
 
-W_CombinationsWithReplacement.typedef = TypeDef("combinations_with_replacement",
-    __module__ = 'itertools',
+W_CombinationsWithReplacement.typedef = TypeDef(
+    "itertools.combinations_with_replacement",
     __new__ = interp2app(W_CombinationsWithReplacement__new__),
     __iter__ = interp2app(W_CombinationsWithReplacement.descr__iter__),
     next = interp2app(W_CombinationsWithReplacement.descr_next),
     res.__init__(space, pool_w, r)
     return space.wrap(res)
 
-W_Permutations.typedef = TypeDef("permutations",
-    __module__ = 'itertools',
+W_Permutations.typedef = TypeDef("itertools.permutations",
     __new__ = interp2app(W_Permutations__new__),
     __iter__ = interp2app(W_Permutations.descr__iter__),
     next = interp2app(W_Permutations.descr_next),

File pypy/module/micronumpy/boxes.py

         return W_UnicodeBox(arr, 0, arr.dtype)
 
 
-W_GenericBox.typedef = TypeDef("generic",
-    __module__ = "numpy",
-
+W_GenericBox.typedef = TypeDef("numpy.generic",
     __new__ = interp2app(W_GenericBox.descr__new__.im_func),
 
     __getitem__ = interp2app(W_GenericBox.descr_getitem),
     flags = GetSetProperty(W_GenericBox.descr_get_flags),
 )
 
-W_BoolBox.typedef = TypeDef("bool_", W_GenericBox.typedef,
-    __module__ = "numpy",
+W_BoolBox.typedef = TypeDef("numpy.bool_", W_GenericBox.typedef,
     __new__ = interp2app(W_BoolBox.descr__new__.im_func),
     __index__ = interp2app(W_BoolBox.descr_index),
     __reduce__ = interp2app(W_BoolBox.descr_reduce),
 )
 
-W_NumberBox.typedef = TypeDef("number", W_GenericBox.typedef,
-    __module__ = "numpy",
+W_NumberBox.typedef = TypeDef("numpy.number", W_GenericBox.typedef,
 )
 
-W_IntegerBox.typedef = TypeDef("integer", W_NumberBox.typedef,
-    __module__ = "numpy",
+W_IntegerBox.typedef = TypeDef("numpy.integer", W_NumberBox.typedef,
 )
 
-W_SignedIntegerBox.typedef = TypeDef("signedinteger", W_IntegerBox.typedef,
-    __module__ = "numpy",
+W_SignedIntegerBox.typedef = TypeDef("numpy.signedinteger", W_IntegerBox.typedef,
 )
 
-W_UnsignedIntegerBox.typedef = TypeDef("unsignedinteger", W_IntegerBox.typedef,
-    __module__ = "numpy",
+W_UnsignedIntegerBox.typedef = TypeDef("numpy.unsignedinteger", W_IntegerBox.typedef,
 )
 
-W_Int8Box.typedef = TypeDef("int8", W_SignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_Int8Box.typedef = TypeDef("numpy.int8", W_SignedIntegerBox.typedef,
     __new__ = interp2app(W_Int8Box.descr__new__.im_func),
     __index__ = interp2app(W_Int8Box.descr_index),
     __reduce__ = interp2app(W_Int8Box.descr_reduce),
 )
 
-W_UInt8Box.typedef = TypeDef("uint8", W_UnsignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_UInt8Box.typedef = TypeDef("numpy.uint8", W_UnsignedIntegerBox.typedef,
     __new__ = interp2app(W_UInt8Box.descr__new__.im_func),
     __index__ = interp2app(W_UInt8Box.descr_index),
     __reduce__ = interp2app(W_UInt8Box.descr_reduce),
 )
 
-W_Int16Box.typedef = TypeDef("int16", W_SignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_Int16Box.typedef = TypeDef("numpy.int16", W_SignedIntegerBox.typedef,
     __new__ = interp2app(W_Int16Box.descr__new__.im_func),
     __index__ = interp2app(W_Int16Box.descr_index),
     __reduce__ = interp2app(W_Int16Box.descr_reduce),
 )
 
-W_UInt16Box.typedef = TypeDef("uint16", W_UnsignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_UInt16Box.typedef = TypeDef("numpy.uint16", W_UnsignedIntegerBox.typedef,
     __new__ = interp2app(W_UInt16Box.descr__new__.im_func),
     __index__ = interp2app(W_UInt16Box.descr_index),
     __reduce__ = interp2app(W_UInt16Box.descr_reduce),
 )
 
-W_Int32Box.typedef = TypeDef("int32", (W_SignedIntegerBox.typedef,) + MIXIN_32,
-    __module__ = "numpy",
+W_Int32Box.typedef = TypeDef("numpy.int32", (W_SignedIntegerBox.typedef,) + MIXIN_32,
     __new__ = interp2app(W_Int32Box.descr__new__.im_func),
     __index__ = interp2app(W_Int32Box.descr_index),
     __reduce__ = interp2app(W_Int32Box.descr_reduce),
 )
 
-W_UInt32Box.typedef = TypeDef("uint32", W_UnsignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_UInt32Box.typedef = TypeDef("numpy.uint32", W_UnsignedIntegerBox.typedef,
     __new__ = interp2app(W_UInt32Box.descr__new__.im_func),
     __index__ = interp2app(W_UInt32Box.descr_index),
     __reduce__ = interp2app(W_UInt32Box.descr_reduce),
 )
 
-W_Int64Box.typedef = TypeDef("int64", (W_SignedIntegerBox.typedef,) + MIXIN_64,
-    __module__ = "numpy",
+W_Int64Box.typedef = TypeDef("numpy.int64", (W_SignedIntegerBox.typedef,) + MIXIN_64,
     __new__ = interp2app(W_Int64Box.descr__new__.im_func),
     __index__ = interp2app(W_Int64Box.descr_index),
     __reduce__ = interp2app(W_Int64Box.descr_reduce),
 )
 
-W_UInt64Box.typedef = TypeDef("uint64", W_UnsignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_UInt64Box.typedef = TypeDef("numpy.uint64", W_UnsignedIntegerBox.typedef,
     __new__ = interp2app(W_UInt64Box.descr__new__.im_func),
     __index__ = interp2app(W_UInt64Box.descr_index),
     __reduce__ = interp2app(W_UInt64Box.descr_reduce),
 )
 
-W_LongBox.typedef = TypeDef("int%d" % LONG_BIT,
+W_LongBox.typedef = TypeDef("numpy.int%d" % LONG_BIT,
     (W_SignedIntegerBox.typedef, W_IntObject.typedef),
-    __module__ = "numpy",
     __new__ = interp2app(W_LongBox.descr__new__.im_func),
     __index__ = interp2app(W_LongBox.descr_index),
     __reduce__ = interp2app(W_LongBox.descr_reduce),
 )
 
-W_ULongBox.typedef = TypeDef("uint%d" % LONG_BIT, W_UnsignedIntegerBox.typedef,
-    __module__ = "numpy",
+W_ULongBox.typedef = TypeDef("numpy.uint%d" % LONG_BIT, W_UnsignedIntegerBox.typedef,
     __new__ = interp2app(W_ULongBox.descr__new__.im_func),
     __index__ = interp2app(W_ULongBox.descr_index),
     __reduce__ = interp2app(W_ULongBox.descr_reduce),
 )
 
-W_InexactBox.typedef = TypeDef("inexact", W_NumberBox.typedef,
-    __module__ = "numpy",
+W_InexactBox.typedef = TypeDef("numpy.inexact", W_NumberBox.typedef,
 )
 
-W_FloatingBox.typedef = TypeDef("floating", W_InexactBox.typedef,
-    __module__ = "numpy",
+W_FloatingBox.typedef = TypeDef("numpy.floating", W_InexactBox.typedef,
 )
 
-W_Float16Box.typedef = TypeDef("float16", W_FloatingBox.typedef,
-    __module__ = "numpy",
+W_Float16Box.typedef = TypeDef("numpy.float16", W_FloatingBox.typedef,
     __new__ = interp2app(W_Float16Box.descr__new__.im_func),
     __reduce__ = interp2app(W_Float16Box.descr_reduce),
 )
 
-W_Float32Box.typedef = TypeDef("float32", W_FloatingBox.typedef,
-    __module__ = "numpy",
+W_Float32Box.typedef = TypeDef("numpy.float32", W_FloatingBox.typedef,
     __new__ = interp2app(W_Float32Box.descr__new__.im_func),
     __reduce__ = interp2app(W_Float32Box.descr_reduce),
 )
 
-W_Float64Box.typedef = TypeDef("float64", (W_FloatingBox.typedef, float_typedef),
-    __module__ = "numpy",
+W_Float64Box.typedef = TypeDef("numpy.float64", (W_FloatingBox.typedef, float_typedef),
     __new__ = interp2app(W_Float64Box.descr__new__.im_func),
     __reduce__ = interp2app(W_Float64Box.descr_reduce),
     as_integer_ratio = interp2app(W_Float64Box.descr_as_integer_ratio),
 )
 
-W_ComplexFloatingBox.typedef = TypeDef("complexfloating", W_InexactBox.typedef,
-    __module__ = "numpy",
+W_ComplexFloatingBox.typedef = TypeDef("numpy.complexfloating", W_InexactBox.typedef,
 )
 
-W_Complex64Box.typedef = TypeDef("complex64", (W_ComplexFloatingBox.typedef),
-    __module__ = "numpy",
+W_Complex64Box.typedef = TypeDef("numpy.complex64", (W_ComplexFloatingBox.typedef),
     __new__ = interp2app(W_Complex64Box.descr__new__.im_func),
     __reduce__ = interp2app(W_Complex64Box.descr_reduce),
     __complex__ = interp2app(W_GenericBox.item),
 )
 
-W_Complex128Box.typedef = TypeDef("complex128", (W_ComplexFloatingBox.typedef, complex_typedef),
-    __module__ = "numpy",
+W_Complex128Box.typedef = TypeDef("numpy.complex128", (W_ComplexFloatingBox.typedef, complex_typedef),
     __new__ = interp2app(W_Complex128Box.descr__new__.im_func),
     __reduce__ = interp2app(W_Complex128Box.descr_reduce),
 )
 
 if long_double_size in (8, 12, 16):
-    W_FloatLongBox.typedef = TypeDef("float%d" % (long_double_size * 8), (W_FloatingBox.typedef),
-        __module__ = "numpy",
+    W_FloatLongBox.typedef = TypeDef("numpy.float%d" % (long_double_size * 8), (W_FloatingBox.typedef),
         __new__ = interp2app(W_FloatLongBox.descr__new__.im_func),
         __reduce__ = interp2app(W_FloatLongBox.descr_reduce),
     )
 
-    W_ComplexLongBox.typedef = TypeDef("complex%d" % (long_double_size * 16), (W_ComplexFloatingBox.typedef, complex_typedef),
-        __module__ = "numpy",
+    W_ComplexLongBox.typedef = TypeDef("numpy.complex%d" % (long_double_size * 16), (W_ComplexFloatingBox.typedef, complex_typedef),
         __new__ = interp2app(W_ComplexLongBox.descr__new__.im_func),
         __reduce__ = interp2app(W_ComplexLongBox.descr_reduce),
         __complex__ = interp2app(W_GenericBox.item),
     )
 
-W_FlexibleBox.typedef = TypeDef("flexible", W_GenericBox.typedef,
-    __module__ = "numpy",
+W_FlexibleBox.typedef = TypeDef("numpy.flexible", W_GenericBox.typedef,
 )
 
-W_VoidBox.typedef = TypeDef("void", W_FlexibleBox.typedef,
-    __module__ = "numpy",
+W_VoidBox.typedef = TypeDef("numpy.void", W_FlexibleBox.typedef,
     __new__ = interp2app(W_VoidBox.descr__new__.im_func),
     __getitem__ = interp2app(W_VoidBox.descr_getitem),
     __setitem__ = interp2app(W_VoidBox.descr_setitem),
 )
 
-W_CharacterBox.typedef = TypeDef("character", W_FlexibleBox.typedef,
-    __module__ = "numpy",
+W_CharacterBox.typedef = TypeDef("numpy.character", W_FlexibleBox.typedef,
 )
 
-W_StringBox.typedef = TypeDef("string_", (W_CharacterBox.typedef, W_BytesObject.typedef),
-    __module__ = "numpy",
+W_StringBox.typedef = TypeDef("numpy.string_", (W_CharacterBox.typedef, W_BytesObject.typedef),
     __new__ = interp2app(W_StringBox.descr__new__string_box.im_func),
     __len__ = interp2app(W_StringBox.descr_len),
 )
 
-W_UnicodeBox.typedef = TypeDef("unicode_", (W_CharacterBox.typedef, W_UnicodeObject.typedef),
-    __module__ = "numpy",
+W_UnicodeBox.typedef = TypeDef("numpy.unicode_", (W_CharacterBox.typedef, W_UnicodeObject.typedef),
     __new__ = interp2app(W_UnicodeBox.descr__new__unicode_box.im_func),
     __len__ = interp2app(W_UnicodeBox.descr_len),
 )

File pypy/module/micronumpy/descriptor.py

 
     def get_name(self):
         name = self.w_box_type.name
+        if name.startswith('numpy.'):
+            name = name[6:]
         if name.endswith('_'):
             name = name[:-1]
         return name
     raise oefmt(space.w_TypeError, "data type not understood")
 
 
-W_Dtype.typedef = TypeDef("dtype",
-    __module__ = "numpy",