diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-04-18 20:50:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-04-18 20:50:24 (GMT) |
commit | 4585ca9428fbe8cae40566d8642c855b0d24a780 (patch) | |
tree | f27f6082a91865b508ccb81be8077c1c817bb5be /Lib/test | |
parent | 9ea1852fb54b3c5908c59a3fbd1475834b72dc56 (diff) | |
download | cpython-4585ca9428fbe8cae40566d8642c855b0d24a780.zip cpython-4585ca9428fbe8cae40566d8642c855b0d24a780.tar.gz cpython-4585ca9428fbe8cae40566d8642c855b0d24a780.tar.bz2 |
Merged revisions 71722,71725 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r71722 | benjamin.peterson | 2009-04-18 15:12:47 -0500 (Sat, 18 Apr 2009) | 1 line
try to initalize all builtin types with PyType_Ready to avoid problems like #5787
........
r71725 | benjamin.peterson | 2009-04-18 15:25:25 -0500 (Sat, 18 Apr 2009) | 1 line
initalize -> initialize
........
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_descr.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index b57e0fa..554e1c8 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1,3 +1,4 @@ +import __builtin__ import types import unittest import warnings @@ -3838,6 +3839,17 @@ order (MRO) for bases """ else: self.fail("new-style class must have a new-style base") + def test_builtin_bases(self): + # Make sure all the builtin types can have their base queried without + # segfaulting. See issue #5787. + builtin_types = [tp for tp in __builtin__.__dict__.itervalues() + if isinstance(tp, type)] + for tp in builtin_types: + object.__getattribute__(tp, "__bases__") + if tp is not object: + self.assertEqual(len(tp.__bases__), 1, tp) + + def test_mutable_bases_with_failing_mro(self): # Testing mutable bases with failing mro... class WorkOnce(type): |