mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
bpo-16965: 2to3 now rewrites execfile() to open with 'rb'. (GH-8569)
This commit is contained in:
parent
0461704060
commit
d4d60134b2
3 changed files with 12 additions and 9 deletions
|
@ -31,7 +31,8 @@ class FixExecfile(fixer_base.BaseFix):
|
|||
# call.
|
||||
execfile_paren = node.children[-1].children[-1].clone()
|
||||
# Construct open().read().
|
||||
open_args = ArgList([filename.clone()], rparen=execfile_paren)
|
||||
open_args = ArgList([filename.clone(), Comma(), String('"rb"', ' ')],
|
||||
rparen=execfile_paren)
|
||||
open_call = Node(syms.power, [Name("open"), open_args])
|
||||
read = [Node(syms.trailer, [Dot(), Name('read')]),
|
||||
Node(syms.trailer, [LParen(), RParen()])]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue