[pypy-svn] r80019 - in pypy/branch/fast-forward/pypy/objspace/std: . test
agaynor at codespeak.net
agaynor at codespeak.net
Mon Dec 13 07:07:27 CET 2010
Author: agaynor
Date: Mon Dec 13 07:07:25 2010
New Revision: 80019
Modified:
pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py
pypy/branch/fast-forward/pypy/objspace/std/typeobject.py
Log:
A unicode string for __slots__ isn't considered as an iterable.
Modified: pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/test/test_typeobject.py Mon Dec 13 07:07:25 2010
@@ -664,6 +664,20 @@
assert c.a == 42
assert c.e == 85
+ def test_string_slots(self):
+ class A(object):
+ __slots__ = "abc"
+
+ class B(object):
+ __slots__ = u"abc"
+
+ a = A()
+ a.abc = "awesome"
+ assert a.abc == "awesome"
+ b = B()
+ b.abc = "awesomer"
+ assert b.abc == "awesomer"
+
def test_base_attr(self):
# check the '__base__'
class A(object):
@@ -1118,4 +1132,3 @@
return x + 1
a = A()
assert a.f(1) == 2
-
Modified: pypy/branch/fast-forward/pypy/objspace/std/typeobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/typeobject.py (original)
+++ pypy/branch/fast-forward/pypy/objspace/std/typeobject.py Mon Dec 13 07:07:25 2010
@@ -556,7 +556,8 @@
wantdict = False
wantweakref = False
w_slots = dict_w['__slots__']
- if space.is_true(space.isinstance(w_slots, space.w_str)):
+ if (space.isinstance_w(w_slots, space.w_str) or
+ space.isinstance_w(w_slots, space.w_unicode)):
slot_names_w = [w_slots]
else:
slot_names_w = space.unpackiterable(w_slots)
More information about the Pypy-commit
mailing list