Commits

Alex Gaynor committed 34bec4f Merge

merged upstream.

Comments (0)

Files changed (42)

-======================================
-PyPy: Python in Python implementation 
-======================================
+=====================================
+PyPy: Python in Python Implementation 
+=====================================
 
 Welcome to PyPy!
 
 
     http://pypy.org/
 
-We invite you to head over to our detailed getting-started document:
-
-    pypy/doc/getting-started.html or
-    pypy/doc/getting-started.txt
-    (local if you got a source tarball or svn checkout)
+The getting-started document will help guide you:
 
     http://codespeak.net/pypy/dist/pypy/doc/getting-started.html
 
-which gives you many good starting and entry points into playing with
-PyPy.  It will also point you to our documentation section which is
-generated from information in the pypy/doc directory.
-
-Enjoy and send us feedback!
+It will also point you to the rest of the documentation which is generated
+from files in the pypy/doc directory within the source repositories. Enjoy
+and send us feedback!
 
     the pypy-dev team <pypy-dev@codespeak.net>

lib-python/modified-2.7.0/ctypes/test/test_cast.py

 import unittest
 import sys
 
-from ctypes.test import xfail
-
 class Test(unittest.TestCase):
 
     def test_array2pointer(self):

lib-python/modified-2.7.0/ctypes/test/test_init.py

 from ctypes import *
 import unittest
-from ctypes.test import xfail
 
 class X(Structure):
     _fields_ = [("a", c_int),
 
 
 class InitTest(unittest.TestCase):
-    @xfail
     def test_get(self):
         # make sure the only accessing a nested structure
         # doesn't call the structure's __new__ and __init__

lib-python/modified-2.7.0/ctypes/test/test_prototypes.py

 from ctypes import *
 import unittest
-from ctypes.test import xfail
 
 # IMPORTANT INFO:
 #

lib-python/modified-2.7.0/ctypes/test/test_refcounts.py

             return a * b * 2
         f = proto(func)
 
+        gc.collect()
         a = sys.getrefcount(ctypes.c_int)
         f(1, 2)
         self.assertEqual(sys.getrefcount(ctypes.c_int), a)

lib-python/modified-2.7.0/test/list_tests.py

         u += "eggs"
         self.assertEqual(u, self.type2test("spameggs"))
 
-        self.assertRaises(TypeError, u.__iadd__, None)
+        def f_iadd(u, x):
+            u += x
+            return u
+
+        self.assertRaises(TypeError, f_iadd, u, None)
 
     def test_imul(self):
         u = self.type2test([0, 1])

lib-python/modified-2.7.0/test/test_ast.py

                 self._assertTrueorder(value, parent_pos)
 
     def test_AST_objects(self):
-        x = ast.AST()
-        try:
-            x.foobar = 21
-        except AttributeError, e:
-            self.assertEquals(e.args[0],
-                              "'_ast.AST' object has no attribute 'foobar'")
-        else:
-            self.assert_(False)
+        if test_support.check_impl_detail():
+            # PyPy also provides a __dict__ to the ast.AST base class.
 
-        try:
-            ast.AST(lineno=2)
-        except AttributeError, e:
-            self.assertEquals(e.args[0],
-                              "'_ast.AST' object has no attribute 'lineno'")
-        else:
-            self.assert_(False)
+            x = ast.AST()
+            try:
+                x.foobar = 21
+            except AttributeError, e:
+                self.assertEquals(e.args[0],
+                                  "'_ast.AST' object has no attribute 'foobar'")
+            else:
+                self.assert_(False)
+
+            try:
+                ast.AST(lineno=2)
+            except AttributeError, e:
+                self.assertEquals(e.args[0],
+                                  "'_ast.AST' object has no attribute 'lineno'")
+            else:
+                self.assert_(False)
+
         try:
             ast.AST(2)
         except TypeError, e:

lib_pypy/_ctypes/__init__.py

 from _ctypes.primitive import _SimpleCData
 from _ctypes.pointer import _Pointer, _cast_addr
 from _ctypes.pointer import POINTER, pointer, _pointer_type_cache
-from _ctypes.function import CFuncPtr
+from _ctypes.function import CFuncPtr, call_function
 from _ctypes.dll import dlopen
 from _ctypes.structure import Structure
 from _ctypes.array import Array

lib_pypy/_ctypes/function.py

     from _ctypes import COMError
     return COMError(errcode, None, None)
 
+def call_function(func, args):
+    "Only for debugging so far: So that we can call CFunction instances"
+    funcptr = CFuncPtr(func)
+    funcptr.restype = int
+    return funcptr(*args)
+
 class CFuncPtrType(_CDataMeta):
     # XXX write down here defaults and such things
 
     errcheck = property(_geterrcheck, _seterrcheck, _delerrcheck)
 
     def _ffishapes(self, args, restype):
+        if args is None:
+            args = []
         argtypes = [arg._ffiargshape for arg in args]
         if restype is not None:
             if not isinstance(restype, SimpleType):
         return callargs, outargs
 
     def __nonzero__(self):
-        return bool(self._buffer[0])
+        return self._com_index is not None or bool(self._buffer[0])
 
     def __del__(self):
         if self._needs_free:

lib_pypy/_ctypes/structure.py

     __setattr__ = struct_setattr
 
     def from_address(self, address):
-        instance = self.__new__(self)
+        instance = StructOrUnion.__new__(self)
         instance.__dict__['_buffer'] = self._ffistruct.fromaddress(address)
         return instance
 
         return _CDataMeta.from_param(self, value)
 
     def _CData_output(self, resarray, base=None, index=-1):
-        res = self.__new__(self)
+        res = StructOrUnion.__new__(self)
         ffistruct = self._ffistruct.fromaddress(resarray.buffer)
         res.__dict__['_buffer'] = ffistruct
         res.__dict__['_base'] = base
         return res
     
     def _CData_retval(self, resbuffer):
-        res = self.__new__(self)
+        res = StructOrUnion.__new__(self)
         res.__dict__['_buffer'] = resbuffer
         res.__dict__['_base'] = None
         res.__dict__['_index'] = -1

pypy/config/pypyoption.py

     "_rawffi": [("objspace.usemodules.struct", True)],
     "cpyext": [("translation.secondaryentrypoints", "cpyext"),
                ("translation.shared", sys.platform == "win32")],
-    "_ffi": [("translation.jit_ffi", True)],
-    }
+}
 
 module_import_dependencies = {
     # no _rawffi if importing pypy.rlib.clibffi raises ImportError
         config.objspace.std.suggest(builtinshortcut=True)
         config.objspace.std.suggest(optimized_list_getitem=True)
         config.objspace.std.suggest(getattributeshortcut=True)
-        config.objspace.std.suggest(newshortcut=True)        
+        config.objspace.std.suggest(newshortcut=True)
         if not IS_64_BITS:
             config.objspace.std.suggest(withsmalllong=True)
 

pypy/interpreter/astcompiler/ast.py

         return space.wrap(node)
     return func_with_new_name(generic_AST_new, "new_%s" % node_class.__name__)
 
+def AST_init(space, w_self, __args__):
+    args_w, kwargs_w = __args__.unpack()
+    if args_w and len(args_w) != 0:
+        w_err = space.wrap("_ast.AST constructor takes 0 positional arguments")
+        raise OperationError(space.w_TypeError, w_err)
+    for field, w_value in kwargs_w.iteritems():
+        space.setattr(w_self, space.wrap(field), w_value)
 
 AST.typedef = typedef.TypeDef("AST",
     _fields=_FieldsWrapper([]),
     __setstate__=interp2app(AST.setstate_w),
     __dict__ = typedef.GetSetProperty(typedef.descr_get_dict,
                                       typedef.descr_set_dict, cls=AST),
+    __new__=interp2app(get_AST_new(AST)),
+    __init__=interp2app(AST_init),
 )
-AST.typedef.acceptable_as_base_class = False
 
 
 def missing_field(space, state, required, host):
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(mod)),
 )
-mod.typedef.acceptable_as_base_class = False
 
 def Module_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Module constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Module constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Module_field_unroller:
     __new__=interp2app(get_AST_new(Module)),
     __init__=interp2app(Module_init),
 )
-Module.typedef.acceptable_as_base_class = False
 
 def Interactive_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Interactive constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Interactive constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Interactive_field_unroller:
     __new__=interp2app(get_AST_new(Interactive)),
     __init__=interp2app(Interactive_init),
 )
-Interactive.typedef.acceptable_as_base_class = False
 
 def Expression_get_body(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Expression constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Expression constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Expression_field_unroller:
     __new__=interp2app(get_AST_new(Expression)),
     __init__=interp2app(Expression_init),
 )
-Expression.typedef.acceptable_as_base_class = False
 
 def Suite_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Suite constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Suite constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Suite_field_unroller:
     __new__=interp2app(get_AST_new(Suite)),
     __init__=interp2app(Suite_init),
 )
-Suite.typedef.acceptable_as_base_class = False
 
 def stmt_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     _attributes=_FieldsWrapper(['lineno', 'col_offset']),
     lineno=typedef.GetSetProperty(stmt_get_lineno, stmt_set_lineno, cls=stmt),
     col_offset=typedef.GetSetProperty(stmt_get_col_offset, stmt_set_col_offset, cls=stmt),
+    __new__=interp2app(get_AST_new(stmt)),
 )
-stmt.typedef.acceptable_as_base_class = False
 
 def FunctionDef_get_name(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 4:
-            w_err = space.wrap("FunctionDef constructor takes 0 or 4 positional arguments")
+            w_err = space.wrap("FunctionDef constructor takes either 0 or 4 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _FunctionDef_field_unroller:
     __new__=interp2app(get_AST_new(FunctionDef)),
     __init__=interp2app(FunctionDef_init),
 )
-FunctionDef.typedef.acceptable_as_base_class = False
 
 def ClassDef_get_name(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 4:
-            w_err = space.wrap("ClassDef constructor takes 0 or 4 positional arguments")
+            w_err = space.wrap("ClassDef constructor takes either 0 or 4 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _ClassDef_field_unroller:
     __new__=interp2app(get_AST_new(ClassDef)),
     __init__=interp2app(ClassDef_init),
 )
-ClassDef.typedef.acceptable_as_base_class = False
 
 def Return_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Return constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Return constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Return_field_unroller:
     __new__=interp2app(get_AST_new(Return)),
     __init__=interp2app(Return_init),
 )
-Return.typedef.acceptable_as_base_class = False
 
 def Delete_get_targets(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Delete constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Delete constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Delete_field_unroller:
     __new__=interp2app(get_AST_new(Delete)),
     __init__=interp2app(Delete_init),
 )
-Delete.typedef.acceptable_as_base_class = False
 
 def Assign_get_targets(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Assign constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Assign constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Assign_field_unroller:
     __new__=interp2app(get_AST_new(Assign)),
     __init__=interp2app(Assign_init),
 )
-Assign.typedef.acceptable_as_base_class = False
 
 def AugAssign_get_target(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("AugAssign constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("AugAssign constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _AugAssign_field_unroller:
     __new__=interp2app(get_AST_new(AugAssign)),
     __init__=interp2app(AugAssign_init),
 )
-AugAssign.typedef.acceptable_as_base_class = False
 
 def Print_get_dest(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Print constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Print constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Print_field_unroller:
     __new__=interp2app(get_AST_new(Print)),
     __init__=interp2app(Print_init),
 )
-Print.typedef.acceptable_as_base_class = False
 
 def For_get_target(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 4:
-            w_err = space.wrap("For constructor takes 0 or 4 positional arguments")
+            w_err = space.wrap("For constructor takes either 0 or 4 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _For_field_unroller:
     __new__=interp2app(get_AST_new(For)),
     __init__=interp2app(For_init),
 )
-For.typedef.acceptable_as_base_class = False
 
 def While_get_test(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("While constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("While constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _While_field_unroller:
     __new__=interp2app(get_AST_new(While)),
     __init__=interp2app(While_init),
 )
-While.typedef.acceptable_as_base_class = False
 
 def If_get_test(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("If constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("If constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _If_field_unroller:
     __new__=interp2app(get_AST_new(If)),
     __init__=interp2app(If_init),
 )
-If.typedef.acceptable_as_base_class = False
 
 def With_get_context_expr(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("With constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("With constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _With_field_unroller:
     __new__=interp2app(get_AST_new(With)),
     __init__=interp2app(With_init),
 )
-With.typedef.acceptable_as_base_class = False
 
 def Raise_get_type(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Raise constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Raise constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Raise_field_unroller:
     __new__=interp2app(get_AST_new(Raise)),
     __init__=interp2app(Raise_init),
 )
-Raise.typedef.acceptable_as_base_class = False
 
 def TryExcept_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("TryExcept constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("TryExcept constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _TryExcept_field_unroller:
     __new__=interp2app(get_AST_new(TryExcept)),
     __init__=interp2app(TryExcept_init),
 )
-TryExcept.typedef.acceptable_as_base_class = False
 
 def TryFinally_get_body(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("TryFinally constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("TryFinally constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _TryFinally_field_unroller:
     __new__=interp2app(get_AST_new(TryFinally)),
     __init__=interp2app(TryFinally_init),
 )
-TryFinally.typedef.acceptable_as_base_class = False
 
 def Assert_get_test(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Assert constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Assert constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Assert_field_unroller:
     __new__=interp2app(get_AST_new(Assert)),
     __init__=interp2app(Assert_init),
 )
-Assert.typedef.acceptable_as_base_class = False
 
 def Import_get_names(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Import constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Import constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Import_field_unroller:
     __new__=interp2app(get_AST_new(Import)),
     __init__=interp2app(Import_init),
 )
-Import.typedef.acceptable_as_base_class = False
 
 def ImportFrom_get_module(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("ImportFrom constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("ImportFrom constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _ImportFrom_field_unroller:
     __new__=interp2app(get_AST_new(ImportFrom)),
     __init__=interp2app(ImportFrom_init),
 )
-ImportFrom.typedef.acceptable_as_base_class = False
 
 def Exec_get_body(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Exec constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Exec constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Exec_field_unroller:
     __new__=interp2app(get_AST_new(Exec)),
     __init__=interp2app(Exec_init),
 )
-Exec.typedef.acceptable_as_base_class = False
 
 def Global_get_names(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Global constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Global constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Global_field_unroller:
     __new__=interp2app(get_AST_new(Global)),
     __init__=interp2app(Global_init),
 )
-Global.typedef.acceptable_as_base_class = False
 
 def Expr_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Expr constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Expr constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Expr_field_unroller:
     __new__=interp2app(get_AST_new(Expr)),
     __init__=interp2app(Expr_init),
 )
-Expr.typedef.acceptable_as_base_class = False
 
 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.acceptable_as_base_class = False
 
 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.acceptable_as_base_class = False
 
 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.acceptable_as_base_class = False
 
 def expr_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     _attributes=_FieldsWrapper(['lineno', 'col_offset']),
     lineno=typedef.GetSetProperty(expr_get_lineno, expr_set_lineno, cls=expr),
     col_offset=typedef.GetSetProperty(expr_get_col_offset, expr_set_col_offset, cls=expr),
+    __new__=interp2app(get_AST_new(expr)),
 )
-expr.typedef.acceptable_as_base_class = False
 
 def BoolOp_get_op(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("BoolOp constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("BoolOp constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _BoolOp_field_unroller:
     __new__=interp2app(get_AST_new(BoolOp)),
     __init__=interp2app(BoolOp_init),
 )
-BoolOp.typedef.acceptable_as_base_class = False
 
 def BinOp_get_left(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("BinOp constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("BinOp constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _BinOp_field_unroller:
     __new__=interp2app(get_AST_new(BinOp)),
     __init__=interp2app(BinOp_init),
 )
-BinOp.typedef.acceptable_as_base_class = False
 
 def UnaryOp_get_op(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("UnaryOp constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("UnaryOp constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _UnaryOp_field_unroller:
     __new__=interp2app(get_AST_new(UnaryOp)),
     __init__=interp2app(UnaryOp_init),
 )
-UnaryOp.typedef.acceptable_as_base_class = False
 
 def Lambda_get_args(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Lambda constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Lambda constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Lambda_field_unroller:
     __new__=interp2app(get_AST_new(Lambda)),
     __init__=interp2app(Lambda_init),
 )
-Lambda.typedef.acceptable_as_base_class = False
 
 def IfExp_get_test(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("IfExp constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("IfExp constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _IfExp_field_unroller:
     __new__=interp2app(get_AST_new(IfExp)),
     __init__=interp2app(IfExp_init),
 )
-IfExp.typedef.acceptable_as_base_class = False
 
 def Dict_get_keys(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Dict constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Dict constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Dict_field_unroller:
     __new__=interp2app(get_AST_new(Dict)),
     __init__=interp2app(Dict_init),
 )
-Dict.typedef.acceptable_as_base_class = False
 
 def Set_get_elts(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Set constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Set constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Set_field_unroller:
     __new__=interp2app(get_AST_new(Set)),
     __init__=interp2app(Set_init),
 )
-Set.typedef.acceptable_as_base_class = False
 
 def ListComp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("ListComp constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("ListComp constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _ListComp_field_unroller:
     __new__=interp2app(get_AST_new(ListComp)),
     __init__=interp2app(ListComp_init),
 )
-ListComp.typedef.acceptable_as_base_class = False
 
 def SetComp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("SetComp constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("SetComp constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _SetComp_field_unroller:
     __new__=interp2app(get_AST_new(SetComp)),
     __init__=interp2app(SetComp_init),
 )
-SetComp.typedef.acceptable_as_base_class = False
 
 def DictComp_get_key(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("DictComp constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("DictComp constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _DictComp_field_unroller:
     __new__=interp2app(get_AST_new(DictComp)),
     __init__=interp2app(DictComp_init),
 )
-DictComp.typedef.acceptable_as_base_class = False
 
 def GeneratorExp_get_elt(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("GeneratorExp constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("GeneratorExp constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _GeneratorExp_field_unroller:
     __new__=interp2app(get_AST_new(GeneratorExp)),
     __init__=interp2app(GeneratorExp_init),
 )
-GeneratorExp.typedef.acceptable_as_base_class = False
 
 def Yield_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Yield constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Yield constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Yield_field_unroller:
     __new__=interp2app(get_AST_new(Yield)),
     __init__=interp2app(Yield_init),
 )
-Yield.typedef.acceptable_as_base_class = False
 
 def Compare_get_left(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Compare constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Compare constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Compare_field_unroller:
     __new__=interp2app(get_AST_new(Compare)),
     __init__=interp2app(Compare_init),
 )
-Compare.typedef.acceptable_as_base_class = False
 
 def Call_get_func(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 5:
-            w_err = space.wrap("Call constructor takes 0 or 5 positional arguments")
+            w_err = space.wrap("Call constructor takes either 0 or 5 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Call_field_unroller:
     __new__=interp2app(get_AST_new(Call)),
     __init__=interp2app(Call_init),
 )
-Call.typedef.acceptable_as_base_class = False
 
 def Repr_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Repr constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Repr constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Repr_field_unroller:
     __new__=interp2app(get_AST_new(Repr)),
     __init__=interp2app(Repr_init),
 )
-Repr.typedef.acceptable_as_base_class = False
 
 def Num_get_n(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Num constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Num constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Num_field_unroller:
     __new__=interp2app(get_AST_new(Num)),
     __init__=interp2app(Num_init),
 )
-Num.typedef.acceptable_as_base_class = False
 
 def Str_get_s(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Str constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Str constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Str_field_unroller:
     __new__=interp2app(get_AST_new(Str)),
     __init__=interp2app(Str_init),
 )
-Str.typedef.acceptable_as_base_class = False
 
 def Attribute_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Attribute constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Attribute constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Attribute_field_unroller:
     __new__=interp2app(get_AST_new(Attribute)),
     __init__=interp2app(Attribute_init),
 )
-Attribute.typedef.acceptable_as_base_class = False
 
 def Subscript_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Subscript constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Subscript constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Subscript_field_unroller:
     __new__=interp2app(get_AST_new(Subscript)),
     __init__=interp2app(Subscript_init),
 )
-Subscript.typedef.acceptable_as_base_class = False
 
 def Name_get_id(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Name constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Name constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Name_field_unroller:
     __new__=interp2app(get_AST_new(Name)),
     __init__=interp2app(Name_init),
 )
-Name.typedef.acceptable_as_base_class = False
 
 def List_get_elts(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("List constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("List constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _List_field_unroller:
     __new__=interp2app(get_AST_new(List)),
     __init__=interp2app(List_init),
 )
-List.typedef.acceptable_as_base_class = False
 
 def Tuple_get_elts(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("Tuple constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("Tuple constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Tuple_field_unroller:
     __new__=interp2app(get_AST_new(Tuple)),
     __init__=interp2app(Tuple_init),
 )
-Tuple.typedef.acceptable_as_base_class = False
 
 def Const_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Const constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Const constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Const_field_unroller:
     __new__=interp2app(get_AST_new(Const)),
     __init__=interp2app(Const_init),
 )
-Const.typedef.acceptable_as_base_class = False
 
 expr_context.typedef = typedef.TypeDef("expr_context",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(expr_context)),
 )
-expr_context.typedef.acceptable_as_base_class = False
 
 _Load.typedef = typedef.TypeDef("Load",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Load)),
 )
-_Load.typedef.acceptable_as_base_class = False
 
 _Store.typedef = typedef.TypeDef("Store",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Store)),
 )
-_Store.typedef.acceptable_as_base_class = False
 
 _Del.typedef = typedef.TypeDef("Del",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Del)),
 )
-_Del.typedef.acceptable_as_base_class = False
 
 _AugLoad.typedef = typedef.TypeDef("AugLoad",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_AugLoad)),
 )
-_AugLoad.typedef.acceptable_as_base_class = False
 
 _AugStore.typedef = typedef.TypeDef("AugStore",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_AugStore)),
 )
-_AugStore.typedef.acceptable_as_base_class = False
 
 _Param.typedef = typedef.TypeDef("Param",
     expr_context.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Param)),
 )
-_Param.typedef.acceptable_as_base_class = False
 
 slice.typedef = typedef.TypeDef("slice",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(slice)),
 )
-slice.typedef.acceptable_as_base_class = False
 
 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.acceptable_as_base_class = False
 
 def Slice_get_lower(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("Slice constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("Slice constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Slice_field_unroller:
     __new__=interp2app(get_AST_new(Slice)),
     __init__=interp2app(Slice_init),
 )
-Slice.typedef.acceptable_as_base_class = False
 
 def ExtSlice_get_dims(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("ExtSlice constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("ExtSlice constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _ExtSlice_field_unroller:
     __new__=interp2app(get_AST_new(ExtSlice)),
     __init__=interp2app(ExtSlice_init),
 )
-ExtSlice.typedef.acceptable_as_base_class = False
 
 def Index_get_value(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 1:
-            w_err = space.wrap("Index constructor takes 0 or 1 positional arguments")
+            w_err = space.wrap("Index constructor takes either 0 or 1 positional argument")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _Index_field_unroller:
     __new__=interp2app(get_AST_new(Index)),
     __init__=interp2app(Index_init),
 )
-Index.typedef.acceptable_as_base_class = False
 
 boolop.typedef = typedef.TypeDef("boolop",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(boolop)),
 )
-boolop.typedef.acceptable_as_base_class = False
 
 _And.typedef = typedef.TypeDef("And",
     boolop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_And)),
 )
-_And.typedef.acceptable_as_base_class = False
 
 _Or.typedef = typedef.TypeDef("Or",
     boolop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Or)),
 )
-_Or.typedef.acceptable_as_base_class = False
 
 operator.typedef = typedef.TypeDef("operator",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(operator)),
 )
-operator.typedef.acceptable_as_base_class = False
 
 _Add.typedef = typedef.TypeDef("Add",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Add)),
 )
-_Add.typedef.acceptable_as_base_class = False
 
 _Sub.typedef = typedef.TypeDef("Sub",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Sub)),
 )
-_Sub.typedef.acceptable_as_base_class = False
 
 _Mult.typedef = typedef.TypeDef("Mult",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Mult)),
 )
-_Mult.typedef.acceptable_as_base_class = False
 
 _Div.typedef = typedef.TypeDef("Div",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Div)),
 )
-_Div.typedef.acceptable_as_base_class = False
 
 _Mod.typedef = typedef.TypeDef("Mod",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Mod)),
 )
-_Mod.typedef.acceptable_as_base_class = False
 
 _Pow.typedef = typedef.TypeDef("Pow",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Pow)),
 )
-_Pow.typedef.acceptable_as_base_class = False
 
 _LShift.typedef = typedef.TypeDef("LShift",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_LShift)),
 )
-_LShift.typedef.acceptable_as_base_class = False
 
 _RShift.typedef = typedef.TypeDef("RShift",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_RShift)),
 )
-_RShift.typedef.acceptable_as_base_class = False
 
 _BitOr.typedef = typedef.TypeDef("BitOr",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitOr)),
 )
-_BitOr.typedef.acceptable_as_base_class = False
 
 _BitXor.typedef = typedef.TypeDef("BitXor",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitXor)),
 )
-_BitXor.typedef.acceptable_as_base_class = False
 
 _BitAnd.typedef = typedef.TypeDef("BitAnd",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_BitAnd)),
 )
-_BitAnd.typedef.acceptable_as_base_class = False
 
 _FloorDiv.typedef = typedef.TypeDef("FloorDiv",
     operator.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_FloorDiv)),
 )
-_FloorDiv.typedef.acceptable_as_base_class = False
 
 unaryop.typedef = typedef.TypeDef("unaryop",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(unaryop)),
 )
-unaryop.typedef.acceptable_as_base_class = False
 
 _Invert.typedef = typedef.TypeDef("Invert",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Invert)),
 )
-_Invert.typedef.acceptable_as_base_class = False
 
 _Not.typedef = typedef.TypeDef("Not",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Not)),
 )
-_Not.typedef.acceptable_as_base_class = False
 
 _UAdd.typedef = typedef.TypeDef("UAdd",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_UAdd)),
 )
-_UAdd.typedef.acceptable_as_base_class = False
 
 _USub.typedef = typedef.TypeDef("USub",
     unaryop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_USub)),
 )
-_USub.typedef.acceptable_as_base_class = False
 
 cmpop.typedef = typedef.TypeDef("cmpop",
     AST.typedef,
     __module__='_ast',
     _attributes=_FieldsWrapper([]),
+    __new__=interp2app(get_AST_new(cmpop)),
 )
-cmpop.typedef.acceptable_as_base_class = False
 
 _Eq.typedef = typedef.TypeDef("Eq",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Eq)),
 )
-_Eq.typedef.acceptable_as_base_class = False
 
 _NotEq.typedef = typedef.TypeDef("NotEq",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_NotEq)),
 )
-_NotEq.typedef.acceptable_as_base_class = False
 
 _Lt.typedef = typedef.TypeDef("Lt",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Lt)),
 )
-_Lt.typedef.acceptable_as_base_class = False
 
 _LtE.typedef = typedef.TypeDef("LtE",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_LtE)),
 )
-_LtE.typedef.acceptable_as_base_class = False
 
 _Gt.typedef = typedef.TypeDef("Gt",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Gt)),
 )
-_Gt.typedef.acceptable_as_base_class = False
 
 _GtE.typedef = typedef.TypeDef("GtE",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_GtE)),
 )
-_GtE.typedef.acceptable_as_base_class = False
 
 _Is.typedef = typedef.TypeDef("Is",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_Is)),
 )
-_Is.typedef.acceptable_as_base_class = False
 
 _IsNot.typedef = typedef.TypeDef("IsNot",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_IsNot)),
 )
-_IsNot.typedef.acceptable_as_base_class = False
 
 _In.typedef = typedef.TypeDef("In",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_In)),
 )
-_In.typedef.acceptable_as_base_class = False
 
 _NotIn.typedef = typedef.TypeDef("NotIn",
     cmpop.typedef,
     _fields=_FieldsWrapper([]),
     __new__=interp2app(get_AST_new(_NotIn)),
 )
-_NotIn.typedef.acceptable_as_base_class = False
 
 def comprehension_get_target(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("comprehension constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("comprehension constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _comprehension_field_unroller:
     __new__=interp2app(get_AST_new(comprehension)),
     __init__=interp2app(comprehension_init),
 )
-comprehension.typedef.acceptable_as_base_class = False
 
 def excepthandler_get_lineno(space, w_self):
     if w_self.w_dict is not None:
     _attributes=_FieldsWrapper(['lineno', 'col_offset']),
     lineno=typedef.GetSetProperty(excepthandler_get_lineno, excepthandler_set_lineno, cls=excepthandler),
     col_offset=typedef.GetSetProperty(excepthandler_get_col_offset, excepthandler_set_col_offset, cls=excepthandler),
+    __new__=interp2app(get_AST_new(excepthandler)),
 )
-excepthandler.typedef.acceptable_as_base_class = False
 
 def ExceptHandler_get_type(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 3:
-            w_err = space.wrap("ExceptHandler constructor takes 0 or 3 positional arguments")
+            w_err = space.wrap("ExceptHandler constructor takes either 0 or 3 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _ExceptHandler_field_unroller:
     __new__=interp2app(get_AST_new(ExceptHandler)),
     __init__=interp2app(ExceptHandler_init),
 )
-ExceptHandler.typedef.acceptable_as_base_class = False
 
 def arguments_get_args(space, w_self):
     if not w_self.initialization_state & 1:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 4:
-            w_err = space.wrap("arguments constructor takes 0 or 4 positional arguments")
+            w_err = space.wrap("arguments constructor takes either 0 or 4 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _arguments_field_unroller:
     __new__=interp2app(get_AST_new(arguments)),
     __init__=interp2app(arguments_init),
 )
-arguments.typedef.acceptable_as_base_class = False
 
 def keyword_get_arg(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("keyword constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("keyword constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _keyword_field_unroller:
     __new__=interp2app(get_AST_new(keyword)),
     __init__=interp2app(keyword_init),
 )
-keyword.typedef.acceptable_as_base_class = False
 
 def alias_get_name(space, w_self):
     if w_self.w_dict is not None:
     args_w, kwargs_w = __args__.unpack()
     if args_w:
         if len(args_w) != 2:
-            w_err = space.wrap("alias constructor takes 0 or 2 positional arguments")
+            w_err = space.wrap("alias constructor takes either 0 or 2 positional arguments")
             raise OperationError(space.w_TypeError, w_err)
         i = 0
         for field in _alias_field_unroller:
     __new__=interp2app(get_AST_new(alias)),
     __init__=interp2app(alias_init),
 )
-alias.typedef.acceptable_as_base_class = False
-
+

pypy/interpreter/astcompiler/tools/asdl_py.py

             setter = "%s_set_%s" % (name, field.name)
             config = (field.name, getter, setter, name)
             self.emit("%s=typedef.GetSetProperty(%s, %s, cls=%s)," % config, 1)
-        # CPython lets you create instances of "abstract" AST nodes
-        # like ast.expr or even ast.AST.  This doesn't seem to useful
-        # and would be a pain to implement safely, so we don't allow
-        # it.
-        if concrete:
-            self.emit("__new__=interp2app(get_AST_new(%s))," % (name,), 1)
-            if needs_init:
-                self.emit("__init__=interp2app(%s_init)," % (name,), 1)
+        self.emit("__new__=interp2app(get_AST_new(%s))," % (name,), 1)
+        if needs_init:
+            self.emit("__init__=interp2app(%s_init)," % (name,), 1)
         self.emit(")")
-        self.emit("%s.typedef.acceptable_as_base_class = False" % (name,))
         self.emit("")
 
     def make_init(self, name, fields):
         arity = len(fields)
         if arity:
             self.emit("if len(args_w) != %i:" % (arity,), 2)
-            self.emit("w_err = space.wrap(\"%s constructor takes 0 or %i " \
-                          "positional arguments\")" % (name, arity), 3)
+            plural = arity > 1 and "s" or ""
+            self.emit("w_err = space.wrap(\"%s constructor takes either 0 or %i " \
+                          "positional argument%s\")" % (name, arity, plural), 3)
             self.emit("raise OperationError(space.w_TypeError, w_err)", 3)
             self.emit("i = 0", 2)
             self.emit("for field in _%s_field_unroller:" % (name,), 2)
         return space.wrap(node)
     return func_with_new_name(generic_AST_new, "new_%s" % node_class.__name__)
 
+def AST_init(space, w_self, __args__):
+    args_w, kwargs_w = __args__.unpack()
+    if args_w and len(args_w) != 0:
+        w_err = space.wrap("_ast.AST constructor takes 0 positional arguments")
+        raise OperationError(space.w_TypeError, w_err)
+    for field, w_value in kwargs_w.iteritems():
+        space.setattr(w_self, space.wrap(field), w_value)
 
 AST.typedef = typedef.TypeDef("AST",
     _fields=_FieldsWrapper([]),
     __setstate__=interp2app(AST.setstate_w),
     __dict__ = typedef.GetSetProperty(typedef.descr_get_dict,
                                       typedef.descr_set_dict, cls=AST),
+    __new__=interp2app(get_AST_new(AST)),
+    __init__=interp2app(AST_init),
 )
-AST.typedef.acceptable_as_base_class = False
 
 
 def missing_field(space, state, required, host):

pypy/jit/backend/llsupport/regalloc.py

         res = self.get(box)
         if res is not None:
             return res
+        size = self.frame_size(box.type)
+        self.frame_depth += ((-self.frame_depth) & (size-1))
+        # ^^^ frame_depth is rounded up to a multiple of 'size', assuming
+        # that 'size' is a power of two.  The reason for doing so is to
+        # avoid obscure issues in jump.py with stack locations that try
+        # to move from position (6,7) to position (7,8).
         newloc = self.frame_pos(self.frame_depth, box.type)
         self.frame_bindings[box] = newloc
-        # Objects returned by frame_pos must support frame_size()
-        self.frame_depth += newloc.frame_size()
+        self.frame_depth += size
         return newloc
 
     # abstract methods that need to be overwritten for specific assemblers
     @staticmethod
     def frame_pos(loc, type):
         raise NotImplementedError("Purely abstract")
+    @staticmethod
+    def frame_size(type):
+        return 1
 
 class RegisterManager(object):
     """ Class that keeps track of register allocations

pypy/jit/backend/llsupport/test/test_regalloc.py

         self.pos = pos
         self.box_type = box_type
 
-    def frame_size(self):
-        if self.box_type == FLOAT:
+class TFrameManager(FrameManager):
+    def frame_pos(self, i, box_type):
+        return FakeFramePos(i, box_type)
+    def frame_size(self, box_type):
+        if box_type == FLOAT:
             return 2
         else:
             return 1
 
-class TFrameManager(FrameManager):
-    def frame_pos(self, i, box_type):
-        return FakeFramePos(i, box_type)
-
 class MockAsm(object):
     def __init__(self):
         self.moves = []

pypy/jit/backend/x86/assembler.py

File contents unchanged.

pypy/jit/backend/x86/jump.py

         assembler.regalloc_mov(src, tmpreg)
         src = tmpreg
     assembler.regalloc_mov(src, dst)
+
+def remap_frame_layout_mixed(assembler,
+                             src_locations1, dst_locations1, tmpreg1,
+                             src_locations2, dst_locations2, tmpreg2):
+    # find and push the xmm stack locations from src_locations2 that
+    # are going to be overwritten by dst_locations1
+    from pypy.jit.backend.x86.arch import WORD
+    extrapushes = []
+    dst_keys = {}
+    for loc in dst_locations1:
+        dst_keys[loc._getregkey()] = None
+    src_locations2red = []
+    dst_locations2red = []
+    for i in range(len(src_locations2)):
+        loc    = src_locations2[i]
+        dstloc = dst_locations2[i]
+        if isinstance(loc, StackLoc):
+            key = loc._getregkey()
+            if (key in dst_keys or (loc.width > WORD and
+                                    (key + WORD) in dst_keys)):
+                assembler.regalloc_push(loc)
+                extrapushes.append(dstloc)
+                continue
+        src_locations2red.append(loc)
+        dst_locations2red.append(dstloc)
+    src_locations2 = src_locations2red
+    dst_locations2 = dst_locations2red
+    #
+    # remap the integer and pointer registers and stack locations
+    remap_frame_layout(assembler, src_locations1, dst_locations1, tmpreg1)
+    #
+    # remap the xmm registers and stack locations
+    remap_frame_layout(assembler, src_locations2, dst_locations2, tmpreg2)
+    #
+    # finally, pop the extra xmm stack locations
+    while len(extrapushes) > 0:
+        loc = extrapushes.pop()
+        assembler.regalloc_pop(loc)

pypy/jit/backend/x86/regalloc.py

 from pypy.rlib.objectmodel import we_are_translated
 from pypy.rlib import rgc
 from pypy.jit.backend.llsupport import symbolic
-from pypy.jit.backend.x86.jump import remap_frame_layout
+from pypy.jit.backend.x86.jump import remap_frame_layout_mixed
 from pypy.jit.codewriter import heaptracker, longlong
 from pypy.jit.codewriter.effectinfo import EffectInfo
 from pypy.jit.metainterp.resoperation import rop
             return StackLoc(i, get_ebp_ofs(i+1), 2, box_type)
         else:
             return StackLoc(i, get_ebp_ofs(i), 1, box_type)
+    @staticmethod
+    def frame_size(box_type):
+        if IS_X86_32 and box_type == FLOAT:
+            return 2
+        else:
+            return 1
 
 class RegAlloc(object):
 
         xmmtmploc = self.xrm.force_allocate_reg(box1, selected_reg=xmmtmp)
         # Part about non-floats
         # XXX we don't need a copy, we only just the original list
-        src_locations = [self.loc(op.getarg(i)) for i in range(op.numargs()) 
+        src_locations1 = [self.loc(op.getarg(i)) for i in range(op.numargs()) 
                          if op.getarg(i).type != FLOAT]
         assert tmploc not in nonfloatlocs
-        dst_locations = [loc for loc in nonfloatlocs if loc is not None]
-        remap_frame_layout(assembler, src_locations, dst_locations, tmploc)
+        dst_locations1 = [loc for loc in nonfloatlocs if loc is not None]
         # Part about floats
-        src_locations = [self.loc(op.getarg(i)) for i in range(op.numargs()) 
+        src_locations2 = [self.loc(op.getarg(i)) for i in range(op.numargs()) 
                          if op.getarg(i).type == FLOAT]
-        dst_locations = [loc for loc in floatlocs if loc is not None]
-        remap_frame_layout(assembler, src_locations, dst_locations, xmmtmp)
+        dst_locations2 = [loc for loc in floatlocs if loc is not None]
+        remap_frame_layout_mixed(assembler,
+                                 src_locations1, dst_locations1, tmploc,
+                                 src_locations2, dst_locations2, xmmtmp)
         self.rm.possibly_free_var(box)
         self.xrm.possibly_free_var(box1)
         self.possibly_free_vars_for_op(op)

pypy/jit/backend/x86/regloc.py

         # One of INT, REF, FLOAT
         self.type = type
 
-    def frame_size(self):
-        return self.width // WORD
-
     def __repr__(self):
         return '%d(%%ebp)' % (self.value,)
 

pypy/jit/backend/x86/test/test_jump.py

+import random
 from pypy.jit.backend.x86.regloc import *
 from pypy.jit.backend.x86.regalloc import X86FrameManager
 from pypy.jit.backend.x86.jump import remap_frame_layout
+from pypy.jit.backend.x86.jump import remap_frame_layout_mixed
 from pypy.jit.metainterp.history import INT
 
 frame_pos = X86FrameManager.frame_pos
                              ('push', s12),
                              ('mov', ebx, s12),
                              ('pop', ebx)]
+
+def test_mixed():
+    assembler = MockAssembler()
+    s23 = frame_pos(2, FLOAT)     # non-conflicting locations
+    s4  = frame_pos(4, INT)
+    remap_frame_layout_mixed(assembler, [ebx], [s4], 'tmp',
+                                        [s23], [xmm5], 'xmmtmp')
+    assert assembler.ops == [('mov', ebx, s4),
+                             ('mov', s23, xmm5)]
+    #
+    if IS_X86_32:
+        assembler = MockAssembler()
+        s23 = frame_pos(2, FLOAT)  # gets stored in pos 2 and 3, with value==3
+        s3  = frame_pos(3, INT)
+        remap_frame_layout_mixed(assembler, [ebx], [s3], 'tmp',
+                                            [s23], [xmm5], 'xmmtmp')
+        assert assembler.ops == [('push', s23),
+                                 ('mov', ebx, s3),
+                                 ('pop', xmm5)]
+    #
+    assembler = MockAssembler()
+    s23 = frame_pos(2, FLOAT)
+    s2  = frame_pos(2, INT)
+    remap_frame_layout_mixed(assembler, [ebx], [s2], 'tmp',
+                                        [s23], [xmm5], 'xmmtmp')
+    assert assembler.ops == [('push', s23),
+                             ('mov', ebx, s2),
+                             ('pop', xmm5)]
+    #
+    assembler = MockAssembler()
+    s4  = frame_pos(4, INT)
+    s45 = frame_pos(4, FLOAT)
+    s1  = frame_pos(1, INT)
+    remap_frame_layout_mixed(assembler, [s4], [s1], edi,
+                                        [s23], [s45], xmm3)
+    assert assembler.ops == [('mov', s4, edi),
+                             ('mov', edi, s1),
+                             ('mov', s23, xmm3),
+                             ('mov', xmm3, s45)]
+    #
+    assembler = MockAssembler()
+    s4  = frame_pos(4, INT)
+    s45 = frame_pos(4, FLOAT)
+    remap_frame_layout_mixed(assembler, [s4], [s2], edi,
+                                        [s23], [s45], xmm3)
+    assert assembler.ops == [('push', s23),
+                             ('mov', s4, edi),
+                             ('mov', edi, s2),
+                             ('pop', s45)]
+    #
+    if IS_X86_32:
+        assembler = MockAssembler()
+        remap_frame_layout_mixed(assembler, [s4], [s3], edi,
+                                 [s23], [s45], xmm3)
+        assert assembler.ops == [('push', s23),
+                                 ('mov', s4, edi),
+                                 ('mov', edi, s3),
+                                 ('pop', s45)]
+
+def test_random_mixed():
+    assembler = MockAssembler()
+    registers1 = [eax, ebx, ecx]
+    registers2 = [xmm0, xmm1, xmm2]
+    if IS_X86_32:
+        XMMWORDS = 2
+    elif IS_X86_64:
+        XMMWORDS = 1
+    #
+    def pick1():
+        n = random.randrange(-3, 10)
+        if n < 0:
+            return registers1[n]
+        else:
+            return frame_pos(n, INT)
+    def pick2():
+        n = random.randrange(-3 , 10 // XMMWORDS)
+        if n < 0:
+            return registers2[n]
+        else:
+            return frame_pos(n * XMMWORDS, FLOAT)
+    #
+    def pick1c():
+        n = random.randrange(-2000, 500)
+        if n >= 0:
+            return imm(n)
+        else:
+            return pick1()
+    #
+    def pick_dst(fn, count, seen):
+        result = []
+        while len(result) < count:
+            x = fn()
+            keys = [x._getregkey()]
+            if isinstance(x, StackLoc) and x.width > WORD:
+                keys.append(keys[0] + WORD)
+            for key in keys:
+                if key in seen:
+                    break
+            else:
+                for key in keys:
+                    seen[key] = True
+                result.append(x)
+        return result
+    #
+    def get_state(locations):
+        regs1 = {}
+        regs2 = {}
+        stack = {}
+        for i, loc in enumerate(locations):
+            if isinstance(loc, RegLoc):
+                if loc.is_xmm:
+                    if loc.width > WORD:
+                        newvalue = ('value-xmm-%d' % i,
+                                    'value-xmm-hiword-%d' % i)
+                    else:
+                        newvalue = 'value-xmm-%d' % i
+                    regs2[loc.value] = newvalue
+                else:
+                    regs1[loc.value] = 'value-int-%d' % i
+            elif isinstance(loc, StackLoc):
+                stack[loc.value] = 'value-width%d-%d' % (loc.width, i)
+                if loc.width > WORD:
+                    stack[loc.value+WORD] = 'value-hiword-%d' % i
+            else:
+                assert isinstance(loc, ImmedLoc)
+        return regs1, regs2, stack
+    #
+    for i in range(500):
+        seen = {}
+        src_locations2 = [pick2() for i in range(4)]
+        dst_locations2 = pick_dst(pick2, 4, seen)
+        src_locations1 = [pick1c() for i in range(5)]
+        dst_locations1 = pick_dst(pick1, 5, seen)<