Commits

Amaury Forgeot d'Arc  committed d0aeef0

Try to fix translation

  • Participants
  • Parent commits 16399db

Comments (0)

Files changed (2)

File pypy/interpreter/astcompiler/ast.py

 
 class AST(Wrappable):
 
-    __slots__ = ("initialization_state", "w_dict")
+    w_dict = None
 
     __metaclass__ = extendabletype
 
+    def __init__(self):
+        self.w_dict = None
+
     def walkabout(self, visitor):
         raise AssertionError("walkabout() implementation not provided")
 
         raise NotImplementedError
 
     def getdict(self, space):
-        if not hasattr(self, 'w_dict'):
+        if self.w_dict is None:
             self.w_dict = space.newdict(instance=True)
         return self.w_dict
 
     __slots__ = ('lineno', 'col_offset')
 
     def __init__(self, lineno, col_offset):
+        AST.__init__(self)
         self.lineno = lineno
         self.col_offset = col_offset
 
     __slots__ = ('lineno', 'col_offset')
 
     def __init__(self, lineno, col_offset):
+        AST.__init__(self)
         self.lineno = lineno
         self.col_offset = col_offset
 
 
 
     def __init__(self):
+        AST.__init__(self)
         self.initialization_state = 0
 
     def walkabout(self, visitor):
     __slots__ = ('lineno', 'col_offset')
 
     def __init__(self, lineno, col_offset):
+        AST.__init__(self)
         self.lineno = lineno
         self.col_offset = col_offset
 
 Interactive.typedef.acceptable_as_base_class = False
 
 def Expression_get_body(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'body')
         if w_obj is not None:
             return w_obj
 Suite.typedef.acceptable_as_base_class = False
 
 def stmt_get_lineno(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'lineno')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= w_self._lineno_mask
 
 def stmt_get_col_offset(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'col_offset')
         if w_obj is not None:
             return w_obj
 stmt.typedef.acceptable_as_base_class = False
 
 def FunctionDef_get_name(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'name')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def FunctionDef_get_args(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'args')
         if w_obj is not None:
             return w_obj
 FunctionDef.typedef.acceptable_as_base_class = False
 
 def ClassDef_get_name(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'name')
         if w_obj is not None:
             return w_obj
 ClassDef.typedef.acceptable_as_base_class = False
 
 def Return_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Assign_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 Assign.typedef.acceptable_as_base_class = False
 
 def AugAssign_get_target(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'target')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def AugAssign_get_op(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'op')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def AugAssign_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 AugAssign.typedef.acceptable_as_base_class = False
 
 def Print_get_dest(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'dest')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Print_get_nl(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'nl')
         if w_obj is not None:
             return w_obj
 Print.typedef.acceptable_as_base_class = False
 
 def For_get_target(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'target')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def For_get_iter(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'iter')
         if w_obj is not None:
             return w_obj
 For.typedef.acceptable_as_base_class = False
 
 def While_get_test(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'test')
         if w_obj is not None:
             return w_obj
 While.typedef.acceptable_as_base_class = False
 
 def If_get_test(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'test')
         if w_obj is not None:
             return w_obj
 If.typedef.acceptable_as_base_class = False
 
 def With_get_context_expr(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'context_expr')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def With_get_optional_vars(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'optional_vars')
         if w_obj is not None:
             return w_obj
 With.typedef.acceptable_as_base_class = False
 
 def Raise_get_type(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'type')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Raise_get_inst(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'inst')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Raise_get_tback(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'tback')
         if w_obj is not None:
             return w_obj
 TryFinally.typedef.acceptable_as_base_class = False
 
 def Assert_get_test(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'test')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Assert_get_msg(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'msg')
         if w_obj is not None:
             return w_obj
 Import.typedef.acceptable_as_base_class = False
 
 def ImportFrom_get_module(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'module')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def ImportFrom_get_level(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'level')
         if w_obj is not None:
             return w_obj
 ImportFrom.typedef.acceptable_as_base_class = False
 
 def Exec_get_body(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'body')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Exec_get_globals(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'globals')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Exec_get_locals(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'locals')
         if w_obj is not None:
             return w_obj
 Global.typedef.acceptable_as_base_class = False
 
 def Expr_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 Continue.typedef.acceptable_as_base_class = False
 
 def expr_get_lineno(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'lineno')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= w_self._lineno_mask
 
 def expr_get_col_offset(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'col_offset')
         if w_obj is not None:
             return w_obj
 expr.typedef.acceptable_as_base_class = False
 
 def BoolOp_get_op(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'op')
         if w_obj is not None:
             return w_obj
 BoolOp.typedef.acceptable_as_base_class = False
 
 def BinOp_get_left(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'left')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def BinOp_get_op(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'op')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def BinOp_get_right(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'right')
         if w_obj is not None:
             return w_obj
 BinOp.typedef.acceptable_as_base_class = False
 
 def UnaryOp_get_op(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'op')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def UnaryOp_get_operand(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'operand')
         if w_obj is not None:
             return w_obj
 UnaryOp.typedef.acceptable_as_base_class = False
 
 def Lambda_get_args(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'args')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Lambda_get_body(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'body')
         if w_obj is not None:
             return w_obj
 Lambda.typedef.acceptable_as_base_class = False
 
 def IfExp_get_test(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'test')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def IfExp_get_body(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'body')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def IfExp_get_orelse(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'orelse')
         if w_obj is not None:
             return w_obj
 Set.typedef.acceptable_as_base_class = False
 
 def ListComp_get_elt(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'elt')
         if w_obj is not None:
             return w_obj
 ListComp.typedef.acceptable_as_base_class = False
 
 def SetComp_get_elt(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'elt')
         if w_obj is not None:
             return w_obj
 SetComp.typedef.acceptable_as_base_class = False
 
 def DictComp_get_key(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'key')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def DictComp_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 DictComp.typedef.acceptable_as_base_class = False
 
 def GeneratorExp_get_elt(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'elt')
         if w_obj is not None:
             return w_obj
 GeneratorExp.typedef.acceptable_as_base_class = False
 
 def Yield_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 Yield.typedef.acceptable_as_base_class = False
 
 def Compare_get_left(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'left')
         if w_obj is not None:
             return w_obj
 Compare.typedef.acceptable_as_base_class = False
 
 def Call_get_func(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'func')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 4
 
 def Call_get_starargs(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'starargs')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 8
 
 def Call_get_kwargs(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'kwargs')
         if w_obj is not None:
             return w_obj
 Call.typedef.acceptable_as_base_class = False
 
 def Repr_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 Repr.typedef.acceptable_as_base_class = False
 
 def Num_get_n(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'n')
         if w_obj is not None:
             return w_obj
 Num.typedef.acceptable_as_base_class = False
 
 def Str_get_s(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 's')
         if w_obj is not None:
             return w_obj
 Str.typedef.acceptable_as_base_class = False
 
 def Attribute_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Attribute_get_attr(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'attr')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Attribute_get_ctx(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'ctx')
         if w_obj is not None:
             return w_obj
 Attribute.typedef.acceptable_as_base_class = False
 
 def Subscript_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Subscript_get_slice(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'slice')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Subscript_get_ctx(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'ctx')
         if w_obj is not None:
             return w_obj
 Subscript.typedef.acceptable_as_base_class = False
 
 def Name_get_id(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'id')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Name_get_ctx(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'ctx')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def List_get_ctx(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'ctx')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Tuple_get_ctx(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'ctx')
         if w_obj is not None:
             return w_obj
 Tuple.typedef.acceptable_as_base_class = False
 
 def Const_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 Ellipsis.typedef.acceptable_as_base_class = False
 
 def Slice_get_lower(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'lower')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def Slice_get_upper(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'upper')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def Slice_get_step(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'step')
         if w_obj is not None:
             return w_obj
 ExtSlice.typedef.acceptable_as_base_class = False
 
 def Index_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 _NotIn.typedef.acceptable_as_base_class = False
 
 def comprehension_get_target(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'target')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def comprehension_get_iter(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'iter')
         if w_obj is not None:
             return w_obj
 comprehension.typedef.acceptable_as_base_class = False
 
 def excepthandler_get_lineno(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'lineno')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= w_self._lineno_mask
 
 def excepthandler_get_col_offset(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'col_offset')
         if w_obj is not None:
             return w_obj
 excepthandler.typedef.acceptable_as_base_class = False
 
 def ExceptHandler_get_type(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'type')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def ExceptHandler_get_name(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'name')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def arguments_get_vararg(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'vararg')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 2
 
 def arguments_get_kwarg(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'kwarg')
         if w_obj is not None:
             return w_obj
 arguments.typedef.acceptable_as_base_class = False
 
 def keyword_get_arg(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'arg')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def keyword_get_value(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'value')
         if w_obj is not None:
             return w_obj
 keyword.typedef.acceptable_as_base_class = False
 
 def alias_get_name(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'name')
         if w_obj is not None:
             return w_obj
     w_self.initialization_state |= 1
 
 def alias_get_asname(space, w_self):
-    if getattr(w_self, 'w_dict', None):
+    if w_self.w_dict is not None:
         w_obj = w_self.getdictvalue(space, 'asname')
         if w_obj is not None:
             return w_obj

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

         else:
             flag = self.data.field_masks[field]
         if not field.seq:
-            self.emit("if getattr(w_self, 'w_dict', None):", 1)
+            self.emit("if w_self.w_dict is not None:", 1)
             self.emit("    w_obj = w_self.getdictvalue(space, '%s')" % (field.name,), 1)
             self.emit("    if w_obj is not None:", 1)
             self.emit("        return w_obj", 1)
 
 class AST(Wrappable):
 
-    __slots__ = ("initialization_state", "w_dict")
+    w_dict = None
 
     __metaclass__ = extendabletype
 
         raise NotImplementedError
 
     def getdict(self, space):
-        if not hasattr(self, 'w_dict'):
+        if self.w_dict is None:
             self.w_dict = space.newdict(instance=True)
         return self.w_dict