Author: Armin Rigo <ar...@tunes.org>
Branch: 
Changeset: r45943:824b72bb6b45
Date: 2011-07-24 17:25 +0200
http://bitbucket.org/pypy/pypy/changeset/824b72bb6b45/

Log:    signal.signal() crashes with ValueError when called from a non-main
        thread...?

diff --git a/lib_pypy/pyrepl/unix_console.py b/lib_pypy/pyrepl/unix_console.py
--- a/lib_pypy/pyrepl/unix_console.py
+++ b/lib_pypy/pyrepl/unix_console.py
@@ -384,14 +384,18 @@
 
         self.__maybe_write_code(self._smkx)
 
+        try:
         self.old_sigwinch = signal.signal(
             signal.SIGWINCH, self.__sigwinch)
+        except ValueError:
+            pass
 
     def restore(self):
         self.__maybe_write_code(self._rmkx)
         self.flushoutput()
         tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate)
 
+        if hasattr(self, 'old_sigwinch'):
         signal.signal(signal.SIGWINCH, self.old_sigwinch)
 
     def __sigwinch(self, signum, frame):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to