From 5309d4a1aacf3bd96acbefe768f8dac35a85d9e8 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Tue, 18 Apr 2017 10:16:50 +0900 Subject: [PATCH] bpo-29950: Rename SlotWrapperType to WrapperDescriptorType --- Doc/library/types.rst | 2 +- Lib/test/test_types.py | 8 ++++---- Lib/types.py | 2 +- Lib/typing.py | 6 +++--- Misc/NEWS | 2 ++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Doc/library/types.rst b/Doc/library/types.rst index 2602e3cf761f5c..89aca9c9df864a 100644 --- a/Doc/library/types.rst +++ b/Doc/library/types.rst @@ -132,7 +132,7 @@ Standard names are defined for the following types: C".) -.. data:: SlotWrapperType +.. data:: WrapperDescriptorType The type of methods of some built-in data types and base classes such as :meth:`object.__init__` or :meth:`object.__lt__`. diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py index 67d3281f3eaffa..3fd66dbc70d851 100644 --- a/Lib/test/test_types.py +++ b/Lib/test/test_types.py @@ -577,10 +577,10 @@ def test_internal_sizes(self): 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) + self.assertIsInstance(object.__init__, types.WrapperDescriptorType) + self.assertIsInstance(object.__str__, types.WrapperDescriptorType) + self.assertIsInstance(object.__lt__, types.WrapperDescriptorType) + self.assertIsInstance(int.__lt__, types.WrapperDescriptorType) def test_method_wrapper_types(self): self.assertIsInstance(object().__init__, types.MethodWrapperType) diff --git a/Lib/types.py b/Lib/types.py index 1b7859e73a19b9..929cba223aa905 100644 --- a/Lib/types.py +++ b/Lib/types.py @@ -36,7 +36,7 @@ def _m(self): pass BuiltinFunctionType = type(len) BuiltinMethodType = type([].append) # Same as BuiltinFunctionType -SlotWrapperType = type(object.__init__) +WrapperDescriptorType = type(object.__init__) MethodWrapperType = type(object().__str__) MethodDescriptorType = type(str.join) diff --git a/Lib/typing.py b/Lib/typing.py index 9a0f49099a3114..d87a59cf266e73 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -11,9 +11,9 @@ except ImportError: import collections as collections_abc # Fallback for PY3.2. try: - from types import SlotWrapperType, MethodWrapperType, MethodDescriptorType + from types import WrapperDescriptorType, MethodWrapperType, MethodDescriptorType except ImportError: - SlotWrapperType = type(object.__init__) + WrapperDescriptorType = type(object.__init__) MethodWrapperType = type(object().__str__) MethodDescriptorType = type(str.join) @@ -1450,7 +1450,7 @@ def _get_defaults(func): _allowed_types = (types.FunctionType, types.BuiltinFunctionType, types.MethodType, types.ModuleType, - SlotWrapperType, MethodWrapperType, MethodDescriptorType) + WrapperDescriptorType, MethodWrapperType, MethodDescriptorType) def get_type_hints(obj, globalns=None, localns=None): diff --git a/Misc/NEWS b/Misc/NEWS index 512592e81bec41..c6f63e2c5efaad 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -313,6 +313,8 @@ Extension Modules Library ------- +- bpo-29950: Rename SlotWrapperType to WrapperDescriptorType. + - bpo-10076: Compiled regular expression and match objects in the re module now support copy.copy() and copy.deepcopy() (they are considered atomic).