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
bbb8ade9
Kaydet (Commit)
bbb8ade9
authored
Mar 16, 2015
tarafından
Robert Collins
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #23631: Fix traceback.format_list when a traceback has been mutated.
üst
93f4d4c1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
5 deletions
+21
-5
test_traceback.py
Lib/test/test_traceback.py
+9
-1
traceback.py
Lib/traceback.py
+10
-4
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_traceback.py
Dosyayı görüntüle @
bbb8ade9
...
...
@@ -555,6 +555,14 @@ class TestStack(unittest.TestCase):
[
' File "foo.py", line 1, in fred
\n
line
\n
'
],
s
.
format
())
def
test_from_list_edited_stack
(
self
):
s
=
traceback
.
StackSummary
.
from_list
([(
'foo.py'
,
1
,
'fred'
,
'line'
)])
s
[
0
]
=
(
'foo.py'
,
2
,
'fred'
,
'line'
)
s2
=
traceback
.
StackSummary
.
from_list
(
s
)
self
.
assertEqual
(
[
' File "foo.py", line 2, in fred
\n
line
\n
'
],
s2
.
format
())
def
test_format_smoke
(
self
):
# For detailed tests see the format_list tests, which consume the same
# code.
...
...
@@ -585,7 +593,7 @@ class TestStack(unittest.TestCase):
traceback
.
walk_stack
(
None
),
capture_locals
=
True
,
limit
=
1
)
s
=
some_inner
(
3
,
4
)
self
.
assertEqual
(
[
' File "'
+
__file__
+
'", line 5
85
, '
[
' File "'
+
__file__
+
'", line 5
93
, '
'in some_inner
\n
'
' traceback.walk_stack(None), capture_locals=True, limit=1)
\n
'
' a = 1
\n
'
...
...
Lib/traceback.py
Dosyayı görüntüle @
bbb8ade9
...
...
@@ -348,11 +348,17 @@ class StackSummary(list):
This method supports the older Python API. Each tuple should be a
4-tuple with (filename, lineno, name, line) elements.
"""
if
isinstance
(
a_list
,
StackSummary
):
return
StackSummary
(
a_list
)
# While doing a fast-path check for isinstance(a_list, StackSummary) is
# appealing, idlelib.run.cleanup_traceback and other similar code may
# break this by making arbitrary frames plain tuples, so we need to
# check on a frame by frame basis.
result
=
StackSummary
()
for
filename
,
lineno
,
name
,
line
in
a_list
:
result
.
append
(
FrameSummary
(
filename
,
lineno
,
name
,
line
=
line
))
for
frame
in
a_list
:
if
isinstance
(
frame
,
FrameSummary
):
result
.
append
(
frame
)
else
:
filename
,
lineno
,
name
,
line
=
frame
result
.
append
(
FrameSummary
(
filename
,
lineno
,
name
,
line
=
line
))
return
result
def
format
(
self
):
...
...
Misc/NEWS
Dosyayı görüntüle @
bbb8ade9
...
...
@@ -18,6 +18,8 @@ Core and Builtins
Library
-------
- Issue #23631: Fix traceback.format_list when a traceback has been mutated.
- Issue #23568: Add rdivmod support to MagicMock() objects.
Patch by Håkan Lövdahl.
...
...
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