[Python-checkins] python/dist/src/Lib sets.py,1.31,1.32

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Thu, 07 Nov 2002 21:03:23 -0800


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

Modified Files:
	sets.py 
Log Message:
Closes SF bug #628246.

The _update method detected mutable elements by trapping TypeErrors.
Unfortunately, this masked useful TypeErrors raised by the iterable
itself.  For cases where it is possible for an iterable to raise 
a TypeError, the iterable is pre-converted to a list outside the
try/except so that any TypeErrors propagate through.



Index: sets.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sets.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** sets.py	4 Oct 2002 20:01:48 -0000	1.31
--- sets.py	8 Nov 2002 05:03:21 -0000	1.32
***************
*** 321,324 ****
--- 321,326 ----
  
          value = True
+         if type(iterable) not in (list, tuple, dict, file, xrange, str):
+             iterable = list(iterable)
          it = iter(iterable)
          while True: