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
c8d30fec
Kaydet (Commit)
c8d30fec
authored
May 20, 2009
tarafından
Jeffrey Yasskin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix issue #1689458 by teaching frame_setlineno how to jump to the first line of
a code object.
üst
cf4ad76a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
+31
-4
test_trace.py
Lib/test/test_trace.py
+21
-0
frameobject.c
Objects/frameobject.c
+10
-4
No files found.
Lib/test/test_trace.py
Dosyayı görüntüle @
c8d30fec
...
...
@@ -740,6 +740,27 @@ class JumpTestCase(unittest.TestCase):
def
test_19_no_jump_without_trace_function
(
self
):
no_jump_without_trace_function
()
def
test_jump_to_firstlineno
(
self
):
# This tests that PDB can jump back to the first line in a
# file. See issue #1689458. It can only be triggered in a
# function call if the function is defined on a single line.
code
=
compile
(
"""
# Comments don't count.
output.append(2) # firstlineno is here.
output.append(3)
output.append(4)
"""
,
"<fake module>"
,
"exec"
)
class
fake_function
:
func_code
=
code
jump
=
(
2
,
0
)
tracer
=
JumpTracer
(
fake_function
)
sys
.
settrace
(
tracer
.
trace
)
namespace
=
{
"output"
:
[]}
exec
code
in
namespace
sys
.
settrace
(
None
)
self
.
compare_jump_output
([
2
,
3
,
2
,
3
,
4
],
namespace
[
"output"
])
def
test_main
():
test_support
.
run_unittest
(
TraceTestCase
,
...
...
Objects/frameobject.c
Dosyayı görüntüle @
c8d30fec
...
...
@@ -140,10 +140,15 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
new_lineno
);
return
-
1
;
}
/* Find the bytecode offset for the start of the given line, or the
* first code-owning line after it. */
PyString_AsStringAndSize
(
f
->
f_code
->
co_lnotab
,
&
lnotab
,
&
lnotab_len
);
else
if
(
new_lineno
==
f
->
f_code
->
co_firstlineno
)
{
new_lasti
=
0
;
new_lineno
=
f
->
f_code
->
co_firstlineno
;
}
else
{
/* Find the bytecode offset for the start of the given
* line, or the first code-owning line after it. */
PyString_AsStringAndSize
(
f
->
f_code
->
co_lnotab
,
&
lnotab
,
&
lnotab_len
);
addr
=
0
;
line
=
f
->
f_code
->
co_firstlineno
;
new_lasti
=
-
1
;
...
...
@@ -156,6 +161,7 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno)
break
;
}
}
}
/* If we didn't reach the requested line, return an error. */
if
(
new_lasti
==
-
1
)
{
...
...
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