Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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__`.
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Lib/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions Misc/NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down