[pypy-issue] Issue #3003: Unable to launch pdb from subprocess reader thread (pypy/pypy)

Andrew Lawrence issues-reply at bitbucket.org
Thu Apr 18 02:15:40 EDT 2019

New issue 3003: Unable to launch pdb from subprocess reader thread

Andrew Lawrence:

While attempting to debug SpawnCmdLineTest.test_basic_script I placed a call to pdb inside the readerthread in subprocess.py

def _readerthread(self, fh, buffer):
            import pdb; pdb.set_trace()

When running the test both reader threads used to communicate with the subprocess raised the following exception:

Exception in thread Thread-2:
Traceback (most recent call last):
  File "C:\pypy\lib-python\3\threading.py", line 916, in _bootstrap_inner
  File "C:\pypy\lib-python\3\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "C:\pypy\lib-python\3\subprocess.py", line 1083, in _readerthread
  File "C:\pypy\lib-python\3\bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "C:\pypy\lib-python\3\bdb.py", line 66, in dispatch_line
  File "C:\pypy\lib-python\3\pdb.py", line 261, in user_line
    self.interaction(frame, None)
  File "C:\pypy\lib-python\3\pdb.py", line 344, in interaction
    signal.signal(signal.SIGINT, Pdb._previous_sigint_handler)
  File "C:\pypy\lib-python\3\signal.py", line 47, in signal
    handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread or with __pypy__.thread.enable_sign

More information about the pypy-issue mailing list