[pypy-svn] r78448 - pypy/trunk/pypy/objspace/std

arigo at codespeak.net arigo at codespeak.net
Fri Oct 29 10:58:01 CEST 2010

Author: arigo
Date: Fri Oct 29 10:58:00 2010
New Revision: 78448

Kill most import; they are unneeded.

Modified: pypy/trunk/pypy/objspace/std/smallintobject.py
--- pypy/trunk/pypy/objspace/std/smallintobject.py	(original)
+++ pypy/trunk/pypy/objspace/std/smallintobject.py	Fri Oct 29 10:58:00 2010
@@ -2,18 +2,13 @@
 Implementation of small ints, stored as odd-valued pointers in the
 translated PyPy.  To enable them, see inttype.py.
-import types
-from pypy.interpreter.error import OperationError
 from pypy.objspace.std import intobject
 from pypy.objspace.std.model import registerimplementation, W_Object
 from pypy.objspace.std.register_all import register_all
-from pypy.objspace.std.multimethod import FailedToImplementArgs
 from pypy.objspace.std.noneobject import W_NoneObject
-from pypy.rlib.rarithmetic import ovfcheck, ovfcheck_lshift, LONG_BIT, r_uint
-from pypy.objspace.std.inttype import wrapint
-from pypy.objspace.std.intobject import W_IntObject, _impl_int_int_pow
+from pypy.objspace.std.intobject import W_IntObject
 from pypy.rlib.objectmodel import UnboxedValue
-from pypy.rlib.rbigint import rbigint
+from pypy.tool.sourcetools import func_with_new_name
 class W_SmallIntObject(W_Object, UnboxedValue):
@@ -46,9 +41,7 @@
             new_name = name.replace("Int", "SmallInt")
             # Copy the function, so the annotator specializes it for
             # W_SmallIntObject.
-            ns[new_name] = types.FunctionType(func.func_code, ns, new_name,
-                                              func.func_defaults,
-                                              func.func_closure)
+            ns[new_name] = func_with_new_name(func, new_name)
     ns["get_integer"] = ns["pos__SmallInt"] = ns["int__SmallInt"]
     ns["get_negint"] = ns["neg__SmallInt"]

More information about the Pypy-commit mailing list