aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib_pypy/_structseq.py')
-rw-r--r--lib_pypy/_structseq.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib_pypy/_structseq.py b/lib_pypy/_structseq.py
index 8ac47ddd84..3a817fef95 100644
--- a/lib_pypy/_structseq.py
+++ b/lib_pypy/_structseq.py
@@ -104,8 +104,11 @@ def structseq_reduce(self):
return type(self), (tuple(self), self.__dict__)
def structseq_setattr(self, attr, value):
- raise AttributeError("%r object has no attribute %r" % (
- self.__class__.__name__, attr))
+ if attr not in type(self).__dict__:
+ raise AttributeError("%r object has no attribute %r" % (
+ self.__class__.__name__, attr))
+ else:
+ raise TypeError("readonly attribute")
def structseq_repr(self):
fields = {}