[pypy-svn] r9309 - in pypy/branch/dist-interpapp/pypy/interpreter: . test
hpk at codespeak.net
hpk at codespeak.net
Fri Feb 18 15:26:50 CET 2005
Author: hpk
Date: Fri Feb 18 15:26:49 2005
New Revision: 9309
Modified:
pypy/branch/dist-interpapp/pypy/interpreter/module.py
pypy/branch/dist-interpapp/pypy/interpreter/test/test_module.py
pypy/branch/dist-interpapp/pypy/interpreter/typedef.py
Log:
let accesses to __dict__ and other internal type-descrs
raise a TypeError (like CPython).
removed superflous code.
Modified: pypy/branch/dist-interpapp/pypy/interpreter/module.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/module.py (original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/module.py Fri Feb 18 15:26:49 2005
@@ -20,9 +20,6 @@
def getdict(self):
return self.w_dict
- def setdict(self, w_dict):
- self.w_dict = w_dict
-
def descr_module__new__(space, w_subtype, __args__):
module = space.allocate_instance(Module, w_subtype)
module.__init__(space, space.wrap('?'))
Modified: pypy/branch/dist-interpapp/pypy/interpreter/test/test_module.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/test/test_module.py (original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/test/test_module.py Fri Feb 18 15:26:49 2005
@@ -37,6 +37,8 @@
delattr(m, 'x')
raises(AttributeError, getattr, m, 'x')
raises(AttributeError, delattr, m, 'x')
+ raises(TypeError, setattr, m, '__dict__', {})
+
def test_docstring(self):
import sys
foo = type(sys)('foo')
Modified: pypy/branch/dist-interpapp/pypy/interpreter/typedef.py
==============================================================================
--- pypy/branch/dist-interpapp/pypy/interpreter/typedef.py (original)
+++ pypy/branch/dist-interpapp/pypy/interpreter/typedef.py Fri Feb 18 15:26:49 2005
@@ -114,7 +114,7 @@
def descr_property_set(space, w_property, w_obj, w_value):
fset = space.interpclass_w(w_property).fset
if fset is None:
- raise OperationError(space.w_AttributeError,
+ raise OperationError(space.w_TypeError,
space.wrap("read-only attribute"))
fset(space, w_obj, w_value)
More information about the Pypy-commit
mailing list