Merged revisions 71722 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
........
This commit is contained in:
Benjamin Peterson 2009-04-18 20:54:08 +00:00
parent 332424777f
commit ae937c021d
4 changed files with 79 additions and 8 deletions

View file

@ -1,3 +1,4 @@
import builtins
import types
import unittest
import warnings
@ -3586,6 +3587,17 @@ order (MRO) for bases """
else:
self.fail("shouldn't be able to create inheritance cycles")
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 builtins.__dict__.values()
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):