Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #29 from pvaret/master

Don't crash when debugging threaded app.
  • Loading branch information...
commit 8d0a9a4c77980c6ac5f7b80f410b03d3b89ce0f6 2 parents b842f7d + 7d9226d
Andreas Klöckner authored
Showing with 19 additions and 3 deletions.
  1. +19 −3 pudb/debugger.py
22 pudb/debugger.py
View
@@ -290,6 +290,24 @@ def _runscript(self, filename):
from pudb.var_view import FrameVarInfoKeeper
+from urwid.raw_display import Screen
+
+class ThreadsafeScreen(Screen):
+ "A Screen subclass that doesn't crash when running from a non-main thread."
+
+ def signal_init(self):
+ "Initialize signal handler, ignoring errors silently."
+ try:
+ super(ThreadsafeScreen, self).signal_init()
+ except ValueError:
+ pass
+
+ def signal_restore(self):
+ "Restore default signal handler, ignoring errors silently."
+ try:
+ super(ThreadsafeScreen, self).signal_restore()
+ except ValueError:
+ pass
class DebuggerUI(FrameVarInfoKeeper):
@@ -1097,9 +1115,7 @@ def help(w, size, key):
# {{{ setup
- import urwid.raw_display as display
-
- self.screen = display.Screen()
+ self.screen = ThreadsafeScreen()
self.setup_palette(self.screen)
self.show_count = 0
Please sign in to comment.
Something went wrong with that request. Please try again.