summaryrefslogtreecommitdiff
path: root/Lib/test/test_types.py
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:50 -0800
committerSteve Dower <steve.dower@microsoft.com>2017-02-04 15:05:50 -0800
commit3b0e4320092ac0504b6670cafaf0301b908c91fc (patch)
treed3be1b6b844d61763bb366fa21ceed475e5703fd /Lib/test/test_types.py
parentb2fa705fd3887c326e811c418469c784353027f4 (diff)
parentf687fbcd73c14dfcbe086eb5cd94b298f1e81e72 (diff)
downloadcpython-3b0e4320092ac0504b6670cafaf0301b908c91fc.tar.gz
Issue #29392: Prevent crash when passing invalid arguments into msvcrt module.
Diffstat (limited to 'Lib/test/test_types.py')
-rw-r--r--Lib/test/test_types.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index 382ca03e5a..4a9fcba526 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -576,6 +576,24 @@ class TypesTests(unittest.TestCase):
self.assertGreater(object.__basicsize__, 0)
self.assertGreater(tuple.__itemsize__, 0)
+ def test_slot_wrapper_types(self):
+ self.assertIsInstance(object.__init__, types.SlotWrapperType)
+ self.assertIsInstance(object.__str__, types.SlotWrapperType)
+ self.assertIsInstance(object.__lt__, types.SlotWrapperType)
+ self.assertIsInstance(int.__lt__, types.SlotWrapperType)
+
+ def test_method_wrapper_types(self):
+ self.assertIsInstance(object().__init__, types.MethodWrapperType)
+ self.assertIsInstance(object().__str__, types.MethodWrapperType)
+ self.assertIsInstance(object().__lt__, types.MethodWrapperType)
+ self.assertIsInstance((42).__lt__, types.MethodWrapperType)
+
+ def test_method_descriptor_types(self):
+ self.assertIsInstance(str.join, types.MethodDescriptorType)
+ self.assertIsInstance(list.append, types.MethodDescriptorType)
+ self.assertIsInstance(''.join, types.BuiltinMethodType)
+ self.assertIsInstance([].append, types.BuiltinMethodType)
+
class MappingProxyTests(unittest.TestCase):
mappingproxy = types.MappingProxyType