diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-03-16 10:58:46 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-03-16 10:58:46 -0500 |
commit | dbc52f8a0d3c496e642dbc92c684f873e67f3127 (patch) | |
tree | 25e405ed6e834b60e012cf7b461f19de9c78e508 /Lib/test/test_class.py | |
parent | 6e7832b04caf33196a56c153821631d33bbb3bff (diff) | |
download | cpython-git-dbc52f8a0d3c496e642dbc92c684f873e67f3127.tar.gz |
check for string attribute names in old-style classes (closes #14334)
Diffstat (limited to 'Lib/test/test_class.py')
-rw-r--r-- | Lib/test/test_class.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_class.py b/Lib/test/test_class.py index db75b93479..e5cdf088f4 100644 --- a/Lib/test/test_class.py +++ b/Lib/test/test_class.py @@ -628,6 +628,13 @@ class ClassTests(unittest.TestCase): a = A(hash(A.f.im_func)^(-1)) hash(a.f) + def testAttrSlots(self): + class C: + pass + for c in C, C(): + self.assertRaises(TypeError, type(c).__getattribute__, c, []) + self.assertRaises(TypeError, type(c).__setattr__, c, [], []) + def test_main(): with test_support.check_py3k_warnings( (".+__(get|set|del)slice__ has been removed", DeprecationWarning), |