Get rid of 'file' built-in. Get rid of types.StringType and friends.
This commit is contained in:
parent
317e774965
commit
74302dbd3c
@ -414,9 +414,7 @@ def installnewio():
|
|||||||
def __new__(cls, *args, **kwds):
|
def __new__(cls, *args, **kwds):
|
||||||
return io.open(*args, **kwds)
|
return io.open(*args, **kwds)
|
||||||
__builtin__.classic_open = __builtin__.open
|
__builtin__.classic_open = __builtin__.open
|
||||||
__builtin__.classic_file = __builtin__.file
|
|
||||||
__builtin__.open = open
|
__builtin__.open = open
|
||||||
__builtin__.file = open
|
|
||||||
sys.stdin = io.open(0, "r")
|
sys.stdin = io.open(0, "r")
|
||||||
sys.stdout = io.open(1, "w")
|
sys.stdout = io.open(1, "w")
|
||||||
sys.stderr = io.open(2, "w")
|
sys.stderr = io.open(2, "w")
|
||||||
|
12
Lib/types.py
12
Lib/types.py
@ -22,17 +22,6 @@ try:
|
|||||||
except NameError:
|
except NameError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
StringType = str
|
|
||||||
|
|
||||||
# StringTypes is already outdated. Instead of writing "type(x) in
|
|
||||||
# types.StringTypes", you should use "isinstance(x, basestring)". But
|
|
||||||
# we keep around for compatibility with Python 2.2.
|
|
||||||
try:
|
|
||||||
UnicodeType = str
|
|
||||||
StringTypes = (StringType, UnicodeType)
|
|
||||||
except NameError:
|
|
||||||
StringTypes = (StringType,)
|
|
||||||
|
|
||||||
BufferType = buffer
|
BufferType = buffer
|
||||||
|
|
||||||
TupleType = tuple
|
TupleType = tuple
|
||||||
@ -62,7 +51,6 @@ BuiltinFunctionType = type(len)
|
|||||||
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
|
BuiltinMethodType = type([].append) # Same as BuiltinFunctionType
|
||||||
|
|
||||||
ModuleType = type(sys)
|
ModuleType = type(sys)
|
||||||
FileType = file
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
@ -2040,7 +2040,6 @@ _PyBuiltin_Init(void)
|
|||||||
#endif
|
#endif
|
||||||
SETBUILTIN("dict", &PyDict_Type);
|
SETBUILTIN("dict", &PyDict_Type);
|
||||||
SETBUILTIN("enumerate", &PyEnum_Type);
|
SETBUILTIN("enumerate", &PyEnum_Type);
|
||||||
SETBUILTIN("file", &PyFile_Type);
|
|
||||||
SETBUILTIN("float", &PyFloat_Type);
|
SETBUILTIN("float", &PyFloat_Type);
|
||||||
SETBUILTIN("frozenset", &PyFrozenSet_Type);
|
SETBUILTIN("frozenset", &PyFrozenSet_Type);
|
||||||
SETBUILTIN("property", &PyProperty_Type);
|
SETBUILTIN("property", &PyProperty_Type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user