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
70f1192d
Kaydet (Commit)
70f1192d
authored
Eyl 29, 2008
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Backport of r66677: _lsprof crasher when a bad external timer is used during
garbage collection of a Profiler object.
üst
b50f9926
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
3 deletions
+30
-3
test_cProfile.py
Lib/test/test_cProfile.py
+17
-2
NEWS
Misc/NEWS
+3
-0
_lsprof.c
Modules/_lsprof.c
+10
-1
No files found.
Lib/test/test_cProfile.py
Dosyayı görüntüle @
70f1192d
"""Test suite for the cProfile module."""
import
cProfile
,
pstats
,
sys
import
cProfile
,
pstats
,
sys
,
test
.
test_support
# In order to have reproducible time, we simulate a timer in the global
# variable 'ticks', which represents simulated time in milliseconds.
...
...
@@ -23,6 +22,7 @@ def test_main():
st
.
strip_dirs
()
.
sort_stats
(
'stdname'
)
.
print_stats
()
st
.
print_callees
()
st
.
print_callers
()
test_bad_counter_during_dealloc
()
def
timer
():
return
ticks
...
...
@@ -119,5 +119,20 @@ class C:
ticks
+=
1
raise
AttributeError
# Issue 3895.
def
test_bad_counter_during_dealloc
():
import
_lsprof
# Must use a file as StringIO doesn't trigger the bug.
sys
.
stderr
=
open
(
test
.
test_support
.
TESTFN
,
'w'
)
try
:
obj
=
_lsprof
.
Profiler
(
lambda
:
int
)
obj
.
enable
()
obj
=
_lsprof
.
Profiler
(
1
)
obj
.
disable
()
finally
:
sys
.
stderr
=
sys
.
__stderr__
test
.
test_support
.
unlink
(
test
.
test_support
.
TESTFN
)
if
__name__
==
"__main__"
:
test_main
()
Misc/NEWS
Dosyayı görüntüle @
70f1192d
...
...
@@ -92,6 +92,9 @@ Core and builtins
Library
-------
-
Issue
#
3895
:
_lsprof
could
be
crashed
with
an
external
timer
that
did
not
return
a
float
when
a
Profiler
object
is
garbage
collected
.
-
Issues
#
3968
and
#
3969
:
two
minor
turtle
problems
.
-
Issue
#
3547
:
Fixed
ctypes
structures
bitfields
of
varying
integer
...
...
Modules/_lsprof.c
Dosyayı görüntüle @
70f1192d
...
...
@@ -150,7 +150,16 @@ static PY_LONG_LONG CallExternalTimer(ProfilerObject *pObj)
}
Py_DECREF
(
o
);
if
(
PyErr_Occurred
())
{
PyErr_WriteUnraisable
((
PyObject
*
)
pObj
);
PyObject
*
context
=
(
PyObject
*
)
pObj
;
/* May have been called by profiler_dealloc(). */
if
(
context
->
ob_refcnt
<
1
)
{
context
=
PyString_FromString
(
"profiler calling an "
"external timer"
);
if
(
context
==
NULL
)
{
return
0
;
}
}
PyErr_WriteUnraisable
(
context
);
return
0
;
}
return
result
;
...
...
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