Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r51322:a69b99cf0083
Date: 2011-12-26 17:26 +0100
http://bitbucket.org/pypy/pypy/changeset/a69b99cf0083/

Log:    Fix for repr of the empty set: set(), not {} which is a dict...

diff --git a/pypy/objspace/std/setobject.py b/pypy/objspace/std/setobject.py
--- a/pypy/objspace/std/setobject.py
+++ b/pypy/objspace/std/setobject.py
@@ -640,6 +640,8 @@
         if set_id in currently_in_repr:
             return '%s(...)' % (s.__class__.__name__,)
         currently_in_repr[set_id] = 1
+        if not s:
+            return '%s()' % (s.__class__.__name__,)
         try:
             listrepr = repr([x for x in s])
             if type(s) is set:
diff --git a/pypy/objspace/std/test/test_setobject.py 
b/pypy/objspace/std/test/test_setobject.py
--- a/pypy/objspace/std/test/test_setobject.py
+++ b/pypy/objspace/std/test/test_setobject.py
@@ -52,7 +52,7 @@
 
     def test_space_newset(self):
         s = self.space.newset()
-        assert self.space.str_w(self.space.repr(s)) == '{}'
+        assert self.space.str_w(self.space.repr(s)) == 'set()'
 
 class AppTestAppSetTest:
     def test_subtype(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to