From: Michael W. Hudson Date: Fri, 22 Feb 2002 13:23:33 +0000 (+0000) Subject: backport gvanrossum's checkin of X-Git-Tag: v2.2.1c1~195 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=03474c5c5da180a91391b2284f77089eb976f580;p=thirdparty%2FPython%2Fcpython.git backport gvanrossum's checkin of revision 2.54 of complexobject.c Declare real and imag as read-only attributes. This fixes SF bug #514858 (Gregory Smith): complex not entirely immutable 2.2.1 Bugfix candidate! --- diff --git a/Objects/complexobject.c b/Objects/complexobject.c index 1ee1c546e5a3..0bc388b896b5 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}, };