[Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.53,2.53.4.1

Michael Hudson mwh@users.sourceforge.net
Fri, 22 Feb 2002 05:23:35 -0800


Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv15196

Modified Files:
      Tag: release22-maint
	complexobject.c 
Log Message:
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!


Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.53
retrieving revision 2.53.4.1
diff -C2 -d -r2.53 -r2.53.4.1
*** complexobject.c	13 Dec 2001 19:52:22 -0000	2.53
--- complexobject.c	22 Feb 2002 13:23:33 -0000	2.53.4.1
***************
*** 630,636 ****
  
  static PyMemberDef complex_members[] = {
! 	{"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), 0,
  	 "the real part of a complex number"},
! 	{"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), 0,
  	 "the imaginary part of a complex number"},
  	{0},
--- 630,636 ----
  
  static PyMemberDef complex_members[] = {
! 	{"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY,
  	 "the real part of a complex number"},
! 	{"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), READONLY,
  	 "the imaginary part of a complex number"},
  	{0},