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
524be305
Kaydet (Commit)
524be305
authored
Şub 01, 2014
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
tracemalloc: Fix slicing traces and fix slicing a traceback.
üst
8f74a73e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
+18
-6
test_tracemalloc.py
Lib/test/test_tracemalloc.py
+8
-2
tracemalloc.py
Lib/tracemalloc.py
+8
-4
NEWS
Misc/NEWS
+2
-0
No files found.
Lib/test/test_tracemalloc.py
Dosyayı görüntüle @
524be305
...
...
@@ -123,7 +123,6 @@ class TestTracemallocEnabled(unittest.TestCase):
self
.
assertEqual
(
len
(
traceback
),
1
)
self
.
assertEqual
(
traceback
,
obj_traceback
)
def
find_trace
(
self
,
traces
,
traceback
):
for
trace
in
traces
:
if
trace
[
1
]
==
traceback
.
_frames
:
...
...
@@ -147,7 +146,6 @@ class TestTracemallocEnabled(unittest.TestCase):
tracemalloc
.
stop
()
self
.
assertEqual
(
tracemalloc
.
_get_traces
(),
[])
def
test_get_traces_intern_traceback
(
self
):
# dummy wrappers to get more useful and identical frames in the traceback
def
allocate_bytes2
(
size
):
...
...
@@ -503,6 +501,14 @@ class TestSnapshot(unittest.TestCase):
self
.
assertEqual
(
str
(
stat
),
'a.py:5: size=5002 B (+5000 B), count=2 (+1), average=2501 B'
)
def
test_slices
(
self
):
snapshot
,
snapshot2
=
create_snapshots
()
self
.
assertEqual
(
snapshot
.
traces
[:
2
],
(
snapshot
.
traces
[
0
],
snapshot
.
traces
[
1
]))
traceback
=
snapshot
.
traces
[
0
]
.
traceback
self
.
assertEqual
(
traceback
[:
2
],
(
traceback
[
0
],
traceback
[
1
]))
class
TestFilters
(
unittest
.
TestCase
):
...
...
Lib/tracemalloc.py
Dosyayı görüntüle @
524be305
...
...
@@ -182,8 +182,10 @@ class Traceback(Sequence):
return
len
(
self
.
_frames
)
def
__getitem__
(
self
,
index
):
trace
=
self
.
_frames
[
index
]
return
Frame
(
trace
)
if
isinstance
(
index
,
slice
):
return
tuple
(
Frame
(
trace
)
for
trace
in
self
.
_frames
[
index
])
else
:
return
Frame
(
self
.
_frames
[
index
])
def
__contains__
(
self
,
frame
):
return
frame
.
_frame
in
self
.
_frames
...
...
@@ -259,8 +261,10 @@ class _Traces(Sequence):
return
len
(
self
.
_traces
)
def
__getitem__
(
self
,
index
):
trace
=
self
.
_traces
[
index
]
return
Trace
(
trace
)
if
isinstance
(
index
,
slice
):
return
tuple
(
Trace
(
trace
)
for
trace
in
self
.
_traces
[
index
])
else
:
return
Trace
(
self
.
_traces
[
index
])
def
__contains__
(
self
,
trace
):
return
trace
.
_trace
in
self
.
_traces
...
...
Misc/NEWS
Dosyayı görüntüle @
524be305
...
...
@@ -16,6 +16,8 @@ Core and Builtins
Library
-------
- tracemalloc: Fix slicing traces and fix slicing a traceback.
- Issue #20354: Fix an alignment issue in the tracemalloc module on 64-bit
platforms. Bug seen on 64-bit Linux when using "make profile-opt".
...
...
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