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
291417da
Kaydet (Commit)
291417da
authored
Eki 12, 2016
tarafından
Xavier de Gaye
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Issue #20766: Merge with 3.5.
üst
ebe17e03
10e54aea
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
pdb.py
Lib/pdb.py
+7
-3
test_pdb.py
Lib/test/test_pdb.py
+23
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pdb.py
Dosyayı görüntüle @
291417da
...
...
@@ -135,6 +135,8 @@ line_prefix = '\n-> ' # Probably a better default
class
Pdb
(
bdb
.
Bdb
,
cmd
.
Cmd
):
_previous_sigint_handler
=
None
def
__init__
(
self
,
completekey
=
'tab'
,
stdin
=
None
,
stdout
=
None
,
skip
=
None
,
nosigint
=
False
,
readrc
=
True
):
bdb
.
Bdb
.
__init__
(
self
,
skip
=
skip
)
...
...
@@ -189,8 +191,6 @@ class Pdb(bdb.Bdb, cmd.Cmd):
self
.
message
(
"
\n
Program interrupted. (Use 'cont' to resume)."
)
self
.
set_step
()
self
.
set_trace
(
frame
)
# restore previous signal handler
signal
.
signal
(
signal
.
SIGINT
,
self
.
_previous_sigint_handler
)
def
reset
(
self
):
bdb
.
Bdb
.
reset
(
self
)
...
...
@@ -339,6 +339,10 @@ class Pdb(bdb.Bdb, cmd.Cmd):
(
expr
,
newvalue
,
oldvalue
))
def
interaction
(
self
,
frame
,
traceback
):
# Restore the previous signal handler at the Pdb prompt.
if
Pdb
.
_previous_sigint_handler
:
signal
.
signal
(
signal
.
SIGINT
,
Pdb
.
_previous_sigint_handler
)
Pdb
.
_previous_sigint_handler
=
None
if
self
.
setup
(
frame
,
traceback
):
# no interaction desired at this time (happens if .pdbrc contains
# a command like "continue")
...
...
@@ -1039,7 +1043,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
"""
if
not
self
.
nosigint
:
try
:
self
.
_previous_sigint_handler
=
\
Pdb
.
_previous_sigint_handler
=
\
signal
.
signal
(
signal
.
SIGINT
,
self
.
sigint_handler
)
except
ValueError
:
# ValueError happens when do_continue() is invoked from
...
...
Lib/test/test_pdb.py
Dosyayı görüntüle @
291417da
...
...
@@ -911,6 +911,29 @@ def test_pdb_next_command_subiterator():
(Pdb) continue
"""
def
test_pdb_issue_20766
():
"""Test for reference leaks when the SIGINT handler is set.
>>> def test_function():
... i = 1
... while i <= 2:
... sess = pdb.Pdb()
... sess.set_trace(sys._getframe())
... print('pdb
%
d:
%
s'
%
(i, sess._previous_sigint_handler))
... i += 1
>>> with PdbTestInput(['continue',
... 'continue']):
... test_function()
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(6)test_function()
-> print('pdb
%
d:
%
s'
%
(i, sess._previous_sigint_handler))
(Pdb) continue
pdb 1: <built-in function default_int_handler>
> <doctest test.test_pdb.test_pdb_issue_20766[0]>(5)test_function()
-> sess.set_trace(sys._getframe())
(Pdb) continue
pdb 2: <built-in function default_int_handler>
"""
class
PdbTestCase
(
unittest
.
TestCase
):
...
...
Misc/NEWS
Dosyayı görüntüle @
291417da
...
...
@@ -13,6 +13,9 @@ Core and Builtins
Library
-------
- Issue #20766: Fix references leaked by pdb in the handling of SIGINT
handlers.
Build
-----
...
...
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