Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r124:714bcbd37203
Date: 2011-07-25 13:36 +0200
http://bitbucket.org/pypy/pyrepl/changeset/714bcbd37203/

Log:    Copy the changeset 824b72bb6b45 from pypy's main repo: on top of
        both CPython and PyPy, signal.signal() raises ValueError when called
        from a non-main thread. In this case just ignore setting up the
        signal handler, for now.

diff --git a/pyrepl/unix_console.py b/pyrepl/unix_console.py
--- a/pyrepl/unix_console.py
+++ b/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
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to