This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients bpb, georg.brandl, isandler, meador.inge
Date 2011-11-27.23:26:51
SpamBayes Score 4.062195e-11
Marked as misclassified No
Message-id <1322436412.3.0.282881587889.issue13120@psf.upfronthosting.co.za>
In-reply-to
Content
Normally a test case is needed.  I tried the following:

diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -595,6 +595,25 @@ def test_pdb_run_with_code_object():
     (Pdb) continue
     """
 
+def test_pdb_continue_in_thread():
+    """Testing the ability to continue from a non-main thread.
+
+    >>> import threading
+    >>>
+    >>> def start_pdb():
+    ...     import pdb
+    ...     pdb.Pdb().set_trace()
+    ...     x = 1
+    ...     y = 1
+    ...
+
+    >>> with PdbTestInput(['continue']):
+    ...    t = threading.Thread(target=start_pdb)
+    ...    t.start()
+    > <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
+    -> x = 1
+    (Pdb) continue
+"""

but 'doctests' doesn't seem to play nicely with threading.  The pdb testsuite fails with:


[meadori@motherbrain cpython]$ ./python -m test test_pdb
[1/1] test_pdb
**********************************************************************
File "/home/meadori/code/python/cpython/Lib/test/test_pdb.py", line 610, in test.test_pdb.test_pdb_continue_in_thread
Failed example:
    with PdbTestInput(['continue']):
       t = threading.Thread(target=start_pdb)
       t.start()
Expected:
    > <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
    -> x = 1
    (Pdb) continue
Got nothing
**********************************************************************
File "/home/meadori/code/python/cpython/Lib/test/test_pdb.py", line 34, in test.test_pdb.test_pdb_displayhook
Failed example:
    def test_function(foo, bar):
        import pdb; pdb.Pdb(nosigint=True).set_trace()
        pass
Expected nothing
Got:
    > <doctest test.test_pdb.test_pdb_continue_in_thread[1]>(4)start_pdb()
Exception in thread Thread-1:

It looks like the output is going to the wrong test.

Anyone else have test ideas?  If not, then I guess it is OK to commit as is.
History
Date User Action Args
2011-11-27 23:26:52meador.ingesetrecipients: + meador.inge, georg.brandl, isandler, bpb
2011-11-27 23:26:52meador.ingesetmessageid: <1322436412.3.0.282881587889.issue13120@psf.upfronthosting.co.za>
2011-11-27 23:26:51meador.ingelinkissue13120 messages
2011-11-27 23:26:51meador.ingecreate