[pypy-svn] r5392 - pypy/trunk/src/pypy/objspace
arigo at codespeak.net
arigo at codespeak.net
Tue Jun 29 19:06:01 CEST 2004
Author: arigo
Date: Tue Jun 29 19:05:59 2004
New Revision: 5392
Modified:
pypy/trunk/src/pypy/objspace/trivial.py
Log:
Killed commented-out lines in trivial.py.
Modified: pypy/trunk/src/pypy/objspace/trivial.py
==============================================================================
--- pypy/trunk/src/pypy/objspace/trivial.py (original)
+++ pypy/trunk/src/pypy/objspace/trivial.py Tue Jun 29 19:05:59 2004
@@ -208,7 +208,7 @@
return space.set(w_descr, w_obj, w_value)
def fdel(w_obj, descr=descr, space=self):
w_descr = space.wrap(descr)
- return space.set(w_descr, w_obj)
+ return space.delete(w_descr, w_obj)
descrdict[descrname] = property(fget, fset, fdel)
cls = type('CPyWrapped '+typedef.name, bases, descrdict)
typedef.trivialwrapperclass = cls
@@ -302,119 +302,6 @@
else:
return DescrOperation.iter(self, w_obj)
-# for _name in ('id', 'type', 'iter', 'repr', 'str', 'len',
-# 'pow', 'divmod', 'hash', 'setattr', 'delattr', 'hex',
-# 'oct', 'ord', 'getattr'):
-# _auto(_name, _name, locals())
-#
- #for _name in ('pos', 'neg', 'not_', 'abs', 'invert',
- # 'mul', 'truediv', 'floordiv', 'div', 'mod',
- # 'add', 'sub', 'lshift', 'rshift', 'and_', 'xor', 'or_',
- # 'lt', 'le', 'eq', 'ne', 'gt', 'ge', 'contains'):
- # _auto(_name, 'operator.' + _name, locals())
-
- # in-place operators
- #def inplace_pow(self, w1, w2):
- # w1 **= w2
- # return self.wrap(w1)
- #def inplace_mul(self, w1, w2):
- # w1 *= w2
- # return self.wrap(w1)
- #def inplace_truediv(self, w1, w2):
- # w1 /= w2 # XXX depends on compiler flags
- # return self.wrap(w1)
- #def inplace_floordiv(self, w1, w2):
- # w1 //= w2
- # return self.wrap(w1)
- #def inplace_div(self, w1, w2):
- # w1 /= w2 # XXX depends on compiler flags
- # return self.wrap(w1)
- #def inplace_mod(self, w1, w2):
- # w1 %= w2
- # return self.wrap(w1)
-
- #def inplace_add(self, w1, w2):
- # w1 += w2
- # return self.wrap(w1)
- #def inplace_sub(self, w1, w2):
- # w1 -= w2
- # return self.wrap(w1)
- #def inplace_lshift(self, w1, w2):
- # w1 <<= w2
- # return self.wrap(w1)
- #def inplace_rshift(self, w1, w2):
- # w1 >>= w2
- # return self.wrap(w1)
- #def inplace_and(self, w1, w2):
- # w1 &= w2
- # return self.wrap(w1)
- #def inplace_or(self, w1, w2):
- # w1 |= w2
- # return self.wrap(w1)
- #def inplace_xor(self, w1, w2):
- # w1 ^= w2
- # return self.wrap(w1)
-
-
- # slicing
- def old_slice(self, index):
- # return the (start, stop) indices of the slice, or None
- # if the w_index is not a slice or a slice with a step
- # this is no longer useful in Python 2.3
- if isinstance(index, types.SliceType):
- if index.step is None or index.step == 1:
- start, stop = index.start, index.stop
- if start is None: start = 0
- if stop is None: stop = sys.maxint
- return start, stop
- return None
-
-## def getitem(self, w_obj, w_index):
-## obj = self.unwrap(w_obj)
-## index = self.unwrap(w_index)
-## sindex = self.old_slice(index)
-## try:
-## if sindex is None:
-## return self.wrap(obj[index])
-## else:
-## return self.wrap(operator.getslice(obj, sindex[0], sindex[1]))
-## except:
-## self.reraise()
-
-## def setitem(self, w_obj, w_index, w_value):
-## obj = self.unwrap(w_obj)
-## index = self.unwrap(w_index)
-## value = self.unwrap(w_value)
-## sindex = self.old_slice(index)
-## try:
-## if sindex is None:
-## obj[index] = value
-## else:
-## operator.setslice(obj, sindex[0], sindex[1], value)
-## except:
-## self.reraise()
-
-## def delitem(self, w_obj, w_index):
-## obj = self.unwrap(w_obj)
-## index = self.unwrap(w_index)
-## sindex = self.old_slice(index)
-## try:
-## if sindex is None:
-## del obj[index]
-## else:
-## operator.delslice(obj, sindex[0], sindex[1])
-## except:
-## self.reraise()
-
- # misc
- #def next(self, w):
- # if hasattr(w, 'pypy_next'):
- # return w.pypy_next()
- # try:
- # return self.wrap(w.next())
- # except StopIteration:
- # raise NoValue
-
def newstring(self, asciilist):
try:
return ''.join([chr(ascii) for ascii in asciilist])
@@ -427,65 +314,6 @@
except:
self.reraise()
- #def call(self, callable, args, kwds):
- # if isinstance(callable, types.ClassType):
- # import new
- # try:
- # r = new.instance(callable)
- # except:
- # self.reraise()
- # if hasattr(r, '__init__'):
- # self.call(r.__init__, args, kwds)
- # return self.wrap(r)
- # #if (isinstance(callable, types.MethodType)
- # and callable.im_self is not None):
- # args = (callable.im_self,) + args
- # callable = callable.im_func
- # assert not isinstance(callable, gateway.Gateway), (
- # "trivial object space is detecting an object that has not "
- # "been wrapped")
- # if hasattr(callable, 'pypy_call'):
- # return callable.pypy_call(args, kwds)
- # try:
- # return self.wrap(callable(*args, **(kwds or {})))
- # except OperationError:
- # raise
- # except:
- # #print "got exception in", callable.__name__
- # #print "len args", len(args)
- # #print "kwds", kwds
- # self.reraise()
- #
- #def get(self, descr, ob, cls):
- # try:
- # return self.wrap(descr.__get__(ob, cls))
- # except:
- # self.reraise()
-
- def new(self, type, args, kw):
- return self.wrap(type(args, kw))
-
- def init(self, type, args, kw):
- pass
-
- #def set(self, descr, ob, val):
- # descr.__set__(ob, val)
-
- #def delete(self, descr, ob):
- # descr.__delete__(ob)
-
- #def nonzero(self, ob):
- # return not not ob
-
- #def float(self, ob):
- # return float(ob)
-
- #def int(self, ob):
- # return int(ob)
-
- #def round(self, *args):
- # return round(*args)
-
def lookup(space, w_obj, name):
assert not isinstance(w_obj, BaseWrappable)
if isinstance(w_obj, CPyWrapper):
More information about the Pypy-commit
mailing list