[pypy-commit] pypy default: signal.signal() crashes with ValueError when called from a

arigo noreply at buildbot.pypy.org
Sun Jul 24 18:47:07 CEST 2011


Author: Armin Rigo <arigo at 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):


More information about the pypy-commit mailing list