mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
bpo-44712: Replace "type(literal)" with corresponding builtin types (GH-27294)
I suppose it is a remnants of very old code written when str, int, list, dict, etc were functions and not classes.
This commit is contained in:
parent
c826867b7c
commit
3680ebed7f
19 changed files with 41 additions and 39 deletions
|
@ -160,7 +160,7 @@ def _write_u32(file, x):
|
|||
class Au_read:
|
||||
|
||||
def __init__(self, f):
|
||||
if type(f) == type(''):
|
||||
if isinstance(f, str):
|
||||
import builtins
|
||||
f = builtins.open(f, 'rb')
|
||||
self._opened = True
|
||||
|
@ -312,7 +312,7 @@ class Au_read:
|
|||
class Au_write:
|
||||
|
||||
def __init__(self, f):
|
||||
if type(f) == type(''):
|
||||
if isinstance(f, str):
|
||||
import builtins
|
||||
f = builtins.open(f, 'wb')
|
||||
self._opened = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue