summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-02-08 21:26:07 (GMT)
committerGuido van Rossum <guido@python.org>2002-02-08 21:26:07 (GMT)
commitfa2e4c27d26ebf34779fbd2d7f77e08fc7bf7bd2 (patch)
tree6822652d5d02729d249a213a6cfcd61c1c004665
parent5ff8cb4f1bb9f722908cf2331c95f9530e5bf108 (diff)
downloadcpython-fa2e4c27d26ebf34779fbd2d7f77e08fc7bf7bd2.zip
cpython-fa2e4c27d26ebf34779fbd2d7f77e08fc7bf7bd2.tar.gz
cpython-fa2e4c27d26ebf34779fbd2d7f77e08fc7bf7bd2.tar.bz2
Declare real and imag as read-only attributes.
This fixes SF bug #514858 (Gregory Smith): complex not entirely immutable 2.2.1 Bugfix candidate!
-rw-r--r--Objects/complexobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 1ee1c54..0bc388b 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -629,9 +629,9 @@ static PyMethodDef complex_methods[] = {
};
static PyMemberDef complex_members[] = {
- {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), 0,
+ {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY,
"the real part of a complex number"},
- {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), 0,
+ {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), READONLY,
"the imaginary part of a complex number"},
{0},
};