[Python-checkins] CVS: python/dist/src/Lib/test test_descr.py,1.108,1.109
Guido van Rossum
gvanrossum@users.sourceforge.net
Wed, 05 Dec 2001 11:46:44 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory usw-pr-cvs1:/tmp/cvs-serv4883/Lib/test
Modified Files:
test_descr.py
Log Message:
At the PythonLabs meeting someone mentioned it would make Jim really
happy if one could delete the __dict__ attribute of an instance. I
love to make Jim happy, so here goes...
- New-style objects now support deleting their __dict__. This is for
all intents and purposes equivalent to assigning a brand new empty
dictionary, but saves space if the object is not used further.
Index: test_descr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_descr.py,v
retrieving revision 1.108
retrieving revision 1.109
diff -C2 -d -r1.108 -r1.109
*** test_descr.py 2001/12/04 16:23:42 1.108
--- test_descr.py 2001/12/05 19:46:42 1.109
***************
*** 2262,2271 ****
cant(a, [])
cant(a, 1)
! try:
! del a.__dict__
! except TypeError:
! pass
! else:
! raise TestFailed, "shouldn't allow del %r.__dict__" % (a)
# Classes don't allow __dict__ assignment
cant(C, {})
--- 2262,2266 ----
cant(a, [])
cant(a, 1)
! del a.__dict__ # Deleting __dict__ is allowed
# Classes don't allow __dict__ assignment
cant(C, {})