Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
d4d60134
Kaydet (Commit)
d4d60134
authored
Eki 13, 2018
tarafından
Zackery Spytz
Kaydeden (comit)
Serhiy Storchaka
Eki 13, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-16965: 2to3 now rewrites execfile() to open with 'rb'. (GH-8569)
üst
04617040
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
9 deletions
+12
-9
fix_execfile.py
Lib/lib2to3/fixes/fix_execfile.py
+2
-1
test_fixers.py
Lib/lib2to3/tests/test_fixers.py
+8
-8
2018-10-12-20-30-42.bpo-16965.xo5LAr.rst
...S.d/next/Library/2018-10-12-20-30-42.bpo-16965.xo5LAr.rst
+2
-0
No files found.
Lib/lib2to3/fixes/fix_execfile.py
Dosyayı görüntüle @
d4d60134
...
...
@@ -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
()])]
...
...
Lib/lib2to3/tests/test_fixers.py
Dosyayı görüntüle @
d4d60134
...
...
@@ -1201,36 +1201,36 @@ class Test_execfile(FixerTestCase):
def
test_conversion
(
self
):
b
=
"""execfile("fn")"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'))"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'))"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", glob)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), glob)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), glob)"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", glob, loc)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), glob, loc)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), glob, loc)"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", globals=glob)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), globals=glob)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), globals=glob)"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", locals=loc)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), locals=loc)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), locals=loc)"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", globals=glob, locals=loc)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), globals=glob, locals=loc)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), globals=glob, locals=loc)"""
self
.
check
(
b
,
a
)
def
test_spacing
(
self
):
b
=
"""execfile( "fn" )"""
a
=
"""exec(compile(open( "fn" ).read(), "fn", 'exec'))"""
a
=
"""exec(compile(open( "fn"
, "rb"
).read(), "fn", 'exec'))"""
self
.
check
(
b
,
a
)
b
=
"""execfile("fn", globals = glob)"""
a
=
"""exec(compile(open("fn").read(), "fn", 'exec'), globals = glob)"""
a
=
"""exec(compile(open("fn"
, "rb"
).read(), "fn", 'exec'), globals = glob)"""
self
.
check
(
b
,
a
)
...
...
Misc/NEWS.d/next/Library/2018-10-12-20-30-42.bpo-16965.xo5LAr.rst
0 → 100644
Dosyayı görüntüle @
d4d60134
The :term:`2to3` :2to3fixer:`execfile` fixer now opens the file with mode
``'rb'``. Patch by Zackery Spytz.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment