diff options
author | Matti Picus <matti.picus@gmail.com> | 2021-03-02 08:17:15 +0200 |
---|---|---|
committer | Matti Picus <matti.picus@gmail.com> | 2021-03-02 08:17:15 +0200 |
commit | fff0a53f1f5e1a087c05f5de9655fb8b90601a34 (patch) | |
tree | 538f4056b15fc62a599ae7bd29ffd8de1401df76 /lib_pypy | |
parent | document branch (diff) | |
download | pypy-fff0a53f1f5e1a087c05f5de9655fb8b90601a34.tar.gz pypy-fff0a53f1f5e1a087c05f5de9655fb8b90601a34.tar.bz2 pypy-fff0a53f1f5e1a087c05f5de9655fb8b90601a34.zip |
fix structseq attribute setter error message
Diffstat (limited to 'lib_pypy')
-rw-r--r-- | lib_pypy/_structseq.py | 7 |
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 = {} |