]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added finalization routines.
authorGuido van Rossum <guido@python.org>
Sat, 2 Aug 1997 03:02:27 +0000 (03:02 +0000)
committerGuido van Rossum <guido@python.org>
Sat, 2 Aug 1997 03:02:27 +0000 (03:02 +0000)
Parser/acceler.c
Parser/intrcheck.c

index 9417b76bd1a59186f090759c2e3a12196f1381f6..9b72023b19061c792f4e9a47b2cd694c08229fbd 100644 (file)
@@ -68,6 +68,26 @@ PyGrammar_AddAccelerators(g)
 #endif
 }
 
+void
+PyGrammar_RemoveAccelerators(g)
+       grammar *g;
+{
+       dfa *d;
+       int i;
+       g->g_accel = 0;
+       d = g->g_dfa;
+       for (i = g->g_ndfas; --i >= 0; d++) {
+               state *s;
+               int j;
+               s = d->d_state;
+               for (j = 0; j < d->d_nstates; j++, s++) {
+                       if (s->s_accel)
+                               PyMem_DEL(s->s_accel);
+                       s->s_accel = NULL;
+               }
+       }
+}
+
 static void
 fixdfa(g, d)
        grammar *g;
index 685e0667780d33c05e77a626afcc59d52bcf4a95..a2a31452bb42454794be613afb616364946a7bec 100644 (file)
@@ -49,6 +49,11 @@ PyOS_InitInterrupts()
 {
 }
 
+void
+PyOS_FiniInterrupts()
+{
+}
+
 int
 PyOS_InterruptOccurred()
 {
@@ -81,6 +86,11 @@ PyOS_InitInterrupts()
        _go32_want_ctrl_break(1 /* TRUE */);
 }
 
+void
+PyOS_FiniInterrupts()
+{
+}
+
 int
 PyOS_InterruptOccurred()
 {
@@ -96,6 +106,11 @@ PyOS_InitInterrupts()
 {
 }
 
+void
+PyOS_FiniInterrupts()
+{
+}
+
 int
 PyOS_InterruptOccurred()
 {
@@ -170,10 +185,12 @@ intcatcher(sig)
        Py_AddPendingCall(PyErr_CheckSignals, NULL);
 }
 
+static RETSIGTYPE (*old_siginthandler)() = SIG_DFL;
+
 void
 PyOS_InitInterrupts()
 {
-       if (signal(SIGINT, SIG_IGN) != SIG_IGN)
+       if ((old_siginthandler = signal(SIGINT, SIG_IGN)) != SIG_IGN)
                signal(SIGINT, intcatcher);
 #ifdef HAVE_SIGINTERRUPT
        /* This is for SunOS and other modern BSD derivatives.
@@ -186,6 +203,12 @@ PyOS_InitInterrupts()
 #endif /* HAVE_SIGINTERRUPT */
 }
 
+void
+PyOS_FiniInterrupts()
+{
+       signal(SIGINT, old_siginthandler);
+}
+
 int
 PyOS_InterruptOccurred()
 {