1. Jędrzej Nowak
  2. pyrepl


Armin Rigo  committed 714bcbd

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.

  • Participants
  • Parent commits 4d9968d
  • Branches default

Comments (0)

Files changed (1)

File pyrepl/unix_console.py

View file
-        self.old_sigwinch = signal.signal(
-            signal.SIGWINCH, self.__sigwinch)
+        try:
+            self.old_sigwinch = signal.signal(
+                signal.SIGWINCH, self.__sigwinch)
+        except ValueError:
+            pass
     def restore(self):
         tcsetattr(self.input_fd, termios.TCSADRAIN, self.__svtermstate)
-        signal.signal(signal.SIGWINCH, self.old_sigwinch)
+        if hasattr(self, 'old_sigwinch'):
+            signal.signal(signal.SIGWINCH, self.old_sigwinch)
     def __sigwinch(self, signum, frame):
         self.height, self.width = self.getheightwidth()