[pypy-svn] r72586 - pypy/trunk/pypy/interpreter
xoraxax at codespeak.net
xoraxax at codespeak.net
Mon Mar 22 19:42:44 CET 2010
Author: xoraxax
Date: Mon Mar 22 19:42:43 2010
New Revision: 72586
Modified:
pypy/trunk/pypy/interpreter/typedef.py
Log:
Revert changes to typedef, does not translate. (svn merge -r 72583:72582 typedef.py).
Modified: pypy/trunk/pypy/interpreter/typedef.py
==============================================================================
--- pypy/trunk/pypy/interpreter/typedef.py (original)
+++ pypy/trunk/pypy/interpreter/typedef.py Mon Mar 22 19:42:43 2010
@@ -301,10 +301,7 @@
# ____________________________________________________________
-def make_descr_typecheck_wrapper(func, extraargs=(), cls=None, cpy_property=False):
- extra_arg = ""
- if cpy_property:
- extra_arg = "property, "
+def make_descr_typecheck_wrapper(func, extraargs=(), cls=None):
if func is None:
return None
if cls is None:
@@ -321,12 +318,12 @@
#print "<CHECK", func.__module__ or '?', func.__name__
assert cls.startswith('<'),"pythontype typecheck should begin with <"
source = """
- def descr_typecheck_%(name)s(%(extra_arg)sspace, w_obj, %(extra)s):
+ def descr_typecheck_%(name)s(space, w_obj, %(extra)s):
if not space.is_true(space.isinstance(w_obj, space.w_%(cls_name)s)):
# xxx improve msg
msg = "descriptor is for '%(expected)s'"
raise OperationError(space.w_TypeError, space.wrap(msg))
- return %(name)s(%(extra_arg)sspace, w_obj, %(extra)s)
+ return %(name)s(space, w_obj, %(extra)s)
"""
cls_name = cls[1:]
expected = repr(cls_name)
@@ -334,9 +331,9 @@
cls_name = cls.__name__
assert issubclass(cls, Wrappable)
source = """
- def descr_typecheck_%(name)s(%(extra_arg)sspace, w_obj, %(extra)s):
+ def descr_typecheck_%(name)s(space, w_obj, %(extra)s):
obj = space.descr_self_interp_w(%(cls_name)s, w_obj)
- return %(name)s(%(extra_arg)sspace, obj, %(extra)s)
+ return %(name)s(space, obj, %(extra)s)
"""
miniglobals[cls_name] = cls
@@ -379,13 +376,12 @@
return res
class GetSetProperty(Wrappable):
- def __init__(self, fget, fset=None, fdel=None, doc=None, cls=None, cpy_property=False):
+ def __init__(self, fget, fset=None, fdel=None, doc=None, cls=None):
"NOT_RPYTHON: initialization-time only"
objclass_getter, cls = make_objclass_getter(fget, cls)
- fget = make_descr_typecheck_wrapper(fget, cls=cls, cpy_property=cpy_property)
- fset = make_descr_typecheck_wrapper(fset, ('w_value',), cls=cls,
- cpy_property=cpy_property)
- fdel = make_descr_typecheck_wrapper(fdel, cls=cls, cpy_property=cpy_property)
+ fget = make_descr_typecheck_wrapper(fget, cls=cls)
+ fset = make_descr_typecheck_wrapper(fset, ('w_value',), cls=cls)
+ fdel = make_descr_typecheck_wrapper(fdel, cls=cls)
self.fget = fget
self.fset = fset
self.fdel = fdel
@@ -393,8 +389,7 @@
self.reqcls = cls
self.name = '<generic property>'
self.objclass_getter = objclass_getter
- self.cpy_property = cpy_property
-
+
def descr_property_get(space, property, w_obj, w_cls=None):
"""property.__get__(obj[, type]) -> value
Read the value of the property of the given obj."""
@@ -405,10 +400,7 @@
return space.wrap(property)
else:
try:
- if property.cpy_property:
- return property.fget(property, space, w_obj)
- else:
- return property.fget(space, w_obj)
+ return property.fget(space, w_obj)
except DescrMismatch, e:
return w_obj.descr_call_mismatch(space, '__getattribute__',\
property.reqcls, Arguments(space, [w_obj,
@@ -422,10 +414,7 @@
raise OperationError(space.w_TypeError,
space.wrap("readonly attribute"))
try:
- if property.cpy_property:
- fset(property, space, w_obj, w_value)
- else:
- fset(space, w_obj, w_value)
+ fset(space, w_obj, w_value)
except DescrMismatch, e:
w_obj.descr_call_mismatch(space, '__setattr__',\
property.reqcls, Arguments(space, [w_obj,
@@ -439,10 +428,7 @@
raise OperationError(space.w_AttributeError,
space.wrap("cannot delete attribute"))
try:
- if property.cpy_property:
- fdel(space, w_obj)
- else:
- fdel(property, space, w_obj)
+ fdel(space, w_obj)
except DescrMismatch, e:
w_obj.descr_call_mismatch(space, '__delattr__',\
property.reqcls, Arguments(space, [w_obj,
More information about the Pypy-commit
mailing list