Author: Manuel Jacob
Branch: kill-multimethod
Changeset: r69438:c7fe33d31de3
Date: 2014-02-25 18:30 +0100
http://bitbucket.org/pypy/pypy/changeset/c7fe33d31de3/
Log: Move rest of pypy.objspace.std.model into pypy.objspace.std.util.
diff --git a/pypy/objspace/std/complexobject.py
b/pypy/objspace/std/complexobject.py
--- a/pypy/objspace/std/complexobject.py
+++ b/pypy/objspace/std/complexobject.py
@@ -272,7 +272,7 @@
if self.user_overridden_class:
return None
from rpython.rlib.longlong2float import float2longlong
- from pypy.objspace.std.model import IDTAG_COMPLEX as tag
+ from pypy.objspace.std.util import IDTAG_COMPLEX as tag
real = space.float_w(space.getattr(self, space.wrap("real")))
imag = space.float_w(space.getattr(self, space.wrap("imag")))
real_b = rbigint.fromrarith_int(float2longlong(real))
diff --git a/pypy/objspace/std/floatobject.py b/pypy/objspace/std/floatobject.py
--- a/pypy/objspace/std/floatobject.py
+++ b/pypy/objspace/std/floatobject.py
@@ -172,7 +172,7 @@
if self.user_overridden_class:
return None
from rpython.rlib.longlong2float import float2longlong
- from pypy.objspace.std.model import IDTAG_FLOAT as tag
+ from pypy.objspace.std.util import IDTAG_FLOAT as tag
val = float2longlong(space.float_w(self))
b = rbigint.fromrarith_int(val)
b = b.lshift(3).or_(rbigint.fromint(tag))
diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -9,7 +9,7 @@
import sys
from rpython.rlib import jit
-from rpython.rlib.objectmodel import instantiate, import_from_mixin, specialize
+from rpython.rlib.objectmodel import instantiate
from rpython.rlib.rarithmetic import (
LONG_BIT, is_valid_int, ovfcheck, r_longlong, r_uint, string_to_int)
from rpython.rlib.rbigint import rbigint
@@ -22,10 +22,9 @@
from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.gateway import WrappedDefault, interp2app, unwrap_spec
from pypy.objspace.std import newformat
-from pypy.objspace.std.model import (
- BINARY_OPS, CMP_OPS, COMMUTATIVE_OPS, IDTAG_INT)
from pypy.objspace.std.stdtypedef import StdTypeDef
-from pypy.objspace.std.util import wrap_parsestringerror
+from pypy.objspace.std.util import (
+ BINARY_OPS, CMP_OPS, COMMUTATIVE_OPS, IDTAG_INT, wrap_parsestringerror)
SENTINEL = object()
@@ -689,7 +688,6 @@
buf = space.interp_w(Buffer, w_buffer)
value, w_longval = _string_to_int_or_long(space, w_value,
buf.as_str())
- ok = True
else:
base = space.int_w(w_base)
diff --git a/pypy/objspace/std/longobject.py b/pypy/objspace/std/longobject.py
--- a/pypy/objspace/std/longobject.py
+++ b/pypy/objspace/std/longobject.py
@@ -15,10 +15,9 @@
WrappedDefault, interp2app, interpindirect2app, unwrap_spec)
from pypy.objspace.std import newformat
from pypy.objspace.std.intobject import W_AbstractIntObject
-from pypy.objspace.std.model import (
- BINARY_OPS, CMP_OPS, COMMUTATIVE_OPS, IDTAG_LONG)
from pypy.objspace.std.stdtypedef import StdTypeDef
-from pypy.objspace.std.util import wrap_parsestringerror
+from pypy.objspace.std.util import (
+ BINARY_OPS, CMP_OPS, COMMUTATIVE_OPS, IDTAG_LONG, wrap_parsestringerror)
def delegate_other(func):
diff --git a/pypy/objspace/std/model.py b/pypy/objspace/std/model.py
deleted file mode 100644
--- a/pypy/objspace/std/model.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from pypy.interpreter.baseobjspace import W_Root
-
-
-IDTAG_INT = 1
-IDTAG_LONG = 3
-IDTAG_FLOAT = 5
-IDTAG_COMPLEX = 7
-
-
-CMP_OPS = dict(lt='<', le='<=', eq='==', ne='!=', gt='>', ge='>=')
-BINARY_BITWISE_OPS = {'and': '&', 'lshift': '<<', 'or': '|', 'rshift': '>>',
- 'xor': '^'}
-BINARY_OPS = dict(add='+', div='/', floordiv='//', mod='%', mul='*', sub='-',
- truediv='/', **BINARY_BITWISE_OPS)
-COMMUTATIVE_OPS = ('add', 'mul', 'and', 'or', 'xor')
diff --git a/pypy/objspace/std/smalllongobject.py
b/pypy/objspace/std/smalllongobject.py
--- a/pypy/objspace/std/smalllongobject.py
+++ b/pypy/objspace/std/smalllongobject.py
@@ -13,7 +13,7 @@
from pypy.interpreter.gateway import WrappedDefault, unwrap_spec
from pypy.objspace.std.intobject import W_AbstractIntObject
from pypy.objspace.std.longobject import W_AbstractLongObject, W_LongObject
-from pypy.objspace.std.model import COMMUTATIVE_OPS
+from pypy.objspace.std.util import COMMUTATIVE_OPS
# XXX: breaks translation
#LONGLONG_MIN = r_longlong(-1 << (LONGLONG_BIT - 1))
diff --git a/pypy/objspace/std/util.py b/pypy/objspace/std/util.py
--- a/pypy/objspace/std/util.py
+++ b/pypy/objspace/std/util.py
@@ -2,6 +2,19 @@
from rpython.rlib.rstring import InvalidBaseError
+IDTAG_INT = 1
+IDTAG_LONG = 3
+IDTAG_FLOAT = 5
+IDTAG_COMPLEX = 7
+
+CMP_OPS = dict(lt='<', le='<=', eq='==', ne='!=', gt='>', ge='>=')
+BINARY_BITWISE_OPS = {'and': '&', 'lshift': '<<', 'or': '|', 'rshift': '>>',
+ 'xor': '^'}
+BINARY_OPS = dict(add='+', div='/', floordiv='//', mod='%', mul='*', sub='-',
+ truediv='/', **BINARY_BITWISE_OPS)
+COMMUTATIVE_OPS = ('add', 'mul', 'and', 'or', 'xor')
+
+
def negate(f):
"""Create a function which calls `f` and negates its result. When the
result is ``space.w_NotImplemented``, ``space.w_NotImplemented`` is
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit