mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
Issue 2408: remove the _types module
It was only used as a helper in types.py to access types (GetSetDescriptorType and MemberDescriptorType), when they can easily be obtained with python code. These expressions even work with Jython. I don't know what the future of the types module is; (cf. discussion in http://bugs.python.org/issue1605 ) at least this change makes it simpler.
This commit is contained in:
parent
24f3c5c646
commit
7adc776ea6
10 changed files with 13 additions and 136 deletions
14
Lib/types.py
14
Lib/types.py
|
@ -86,16 +86,8 @@ EllipsisType = type(Ellipsis)
|
|||
DictProxyType = type(TypeType.__dict__)
|
||||
NotImplementedType = type(NotImplemented)
|
||||
|
||||
# Extension types defined in a C helper module. XXX There may be no
|
||||
# equivalent in implementations other than CPython, so it seems better to
|
||||
# leave them undefined then to set them to e.g. None.
|
||||
try:
|
||||
import _types
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
GetSetDescriptorType = type(_types.Helper.getter)
|
||||
MemberDescriptorType = type(_types.Helper.member)
|
||||
del _types
|
||||
# For Jython, the following two types are identical
|
||||
GetSetDescriptorType = type(FunctionType.func_code)
|
||||
MemberDescriptorType = type(FunctionType.func_globals)
|
||||
|
||||
del sys, _f, _g, _C, _x # Not for export
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue