Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
de67a423
Commit
de67a423
authored
Dec 04, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Plain Diff
Merge issue #13120: Allow to call pdb.set_trace() from thread.
Patch by Ilya Sandler.
parents
8dbd421b
1dfb5c1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
2 deletions
+39
-2
Lib/pdb.py
Lib/pdb.py
+9
-2
Lib/test/test_pdb.py
Lib/test/test_pdb.py
+27
-0
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/pdb.py
View file @
de67a423
...
@@ -1031,8 +1031,15 @@ class Pdb(bdb.Bdb, cmd.Cmd):
...
@@ -1031,8 +1031,15 @@ class Pdb(bdb.Bdb, cmd.Cmd):
Continue execution, only stop when a breakpoint is encountered.
Continue execution, only stop when a breakpoint is encountered.
"""
"""
if
not
self
.
nosigint
:
if
not
self
.
nosigint
:
self
.
_previous_sigint_handler
=
\
try
:
signal
.
signal
(
signal
.
SIGINT
,
self
.
sigint_handler
)
self
.
_previous_sigint_handler
=
\
signal
.
signal
(
signal
.
SIGINT
,
self
.
sigint_handler
)
except
ValueError
:
# ValueError happens when do_continue() is invoked from
# a non-main thread in which case we just continue without
# SIGINT set. Would printing a message here (once) make
# sense?
pass
self
.
set_continue
()
self
.
set_continue
()
return
1
return
1
do_c
=
do_cont
=
do_continue
do_c
=
do_cont
=
do_continue
...
...
Lib/test/test_pdb.py
View file @
de67a423
...
@@ -667,6 +667,33 @@ class PdbTestCase(unittest.TestCase):
...
@@ -667,6 +667,33 @@ class PdbTestCase(unittest.TestCase):
any
(
'main.py(5)foo()->None'
in
l
for
l
in
stdout
.
splitlines
()),
any
(
'main.py(5)foo()->None'
in
l
for
l
in
stdout
.
splitlines
()),
'Fail to step into the caller after a return'
)
'Fail to step into the caller after a return'
)
def
test_issue13210
(
self
):
# invoking "continue" on a non-main thread triggered an exception
# inside signal.signal
with
open
(
support
.
TESTFN
,
'wb'
)
as
f
:
f
.
write
(
textwrap
.
dedent
(
"""
import threading
import pdb
def start_pdb():
pdb.Pdb().set_trace()
x = 1
y = 1
t = threading.Thread(target=start_pdb)
t.start()"""
).
encode
(
'ascii'
))
cmd
=
[
sys
.
executable
,
'-u'
,
support
.
TESTFN
]
proc
=
subprocess
.
Popen
(
cmd
,
stdout
=
subprocess
.
PIPE
,
stdin
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
self
.
addCleanup
(
proc
.
stdout
.
close
)
stdout
,
stderr
=
proc
.
communicate
(
b'cont
\
n
'
)
self
.
assertNotIn
(
'Error'
,
stdout
.
decode
(),
"Got an error running test script under PDB"
)
def
tearDown
(
self
):
def
tearDown
(
self
):
support
.
unlink
(
support
.
TESTFN
)
support
.
unlink
(
support
.
TESTFN
)
...
...
Misc/NEWS
View file @
de67a423
...
@@ -153,6 +153,9 @@ Core and Builtins
...
@@ -153,6 +153,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
13120
:
Allow
to
call
pdb
.
set_trace
()
from
thread
.
Patch
by
Ilya
Sandler
.
-
Issue
#
16585
:
Make
CJK
encoders
support
error
handlers
that
return
bytes
per
-
Issue
#
16585
:
Make
CJK
encoders
support
error
handlers
that
return
bytes
per
PEP
383.
PEP
383.
...
...
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