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
28c17909
Kaydet (Commit)
28c17909
authored
Nis 05, 2018
tarafından
Miss Islington (bot)
Kaydeden (comit)
Raymond Hettinger
Nis 05, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-33224: PEP 479 fix for difflib.mdiff() (GH-6381) (GH-6390)
üst
baf304e8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
8 deletions
+22
-8
difflib.py
Lib/difflib.py
+12
-8
test_difflib.py
Lib/test/test_difflib.py
+8
-0
2018-04-04-23-41-30.bpo-33224.pyR0jB.rst
...S.d/next/Library/2018-04-04-23-41-30.bpo-33224.pyR0jB.rst
+2
-0
No files found.
Lib/difflib.py
Dosyayı görüntüle @
28c17909
...
...
@@ -1634,14 +1634,18 @@ def _mdiff(fromlines, tolines, context=None, linejunk=None,
lines_to_write
-=
1
# Now yield the context lines after the change
lines_to_write
=
context
-
1
while
(
lines_to_write
):
from_line
,
to_line
,
found_diff
=
next
(
line_pair_iterator
)
# If another change within the context, extend the context
if
found_diff
:
lines_to_write
=
context
-
1
else
:
lines_to_write
-=
1
yield
from_line
,
to_line
,
found_diff
try
:
while
(
lines_to_write
):
from_line
,
to_line
,
found_diff
=
next
(
line_pair_iterator
)
# If another change within the context, extend the context
if
found_diff
:
lines_to_write
=
context
-
1
else
:
lines_to_write
-=
1
yield
from_line
,
to_line
,
found_diff
except
StopIteration
:
# Catch exception from next() and return normally
return
_file_template
=
"""
...
...
Lib/test/test_difflib.py
Dosyayı görüntüle @
28c17909
...
...
@@ -93,6 +93,14 @@ class TestSFbugs(unittest.TestCase):
self
.
assertEqual
(
"+
\t\t
I am a bug"
,
diff
[
2
])
self
.
assertEqual
(
"? +
\n
"
,
diff
[
3
])
def
test_mdiff_catch_stop_iteration
(
self
):
# Issue #33224
self
.
assertEqual
(
list
(
difflib
.
_mdiff
([
"2"
],
[
"3"
],
1
)),
[((
1
,
'
\x00
-2
\x01
'
),
(
1
,
'
\x00
+3
\x01
'
),
True
)],
)
patch914575_from1
=
"""
1. Beautiful is beTTer than ugly.
2. Explicit is better than implicit.
...
...
Misc/NEWS.d/next/Library/2018-04-04-23-41-30.bpo-33224.pyR0jB.rst
0 → 100644
Dosyayı görüntüle @
28c17909
Update difflib.mdiff() for PEP 479. Convert an uncaught StopIteration in a
generator into a return-statement.
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