Kaydet (Commit) aee094cc authored tarafından Guido van Rossum's avatar Guido van Rossum

Added finalization routines.

üst 08c16615
...@@ -68,6 +68,26 @@ PyGrammar_AddAccelerators(g) ...@@ -68,6 +68,26 @@ PyGrammar_AddAccelerators(g)
#endif #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 static void
fixdfa(g, d) fixdfa(g, d)
grammar *g; grammar *g;
......
...@@ -49,6 +49,11 @@ PyOS_InitInterrupts() ...@@ -49,6 +49,11 @@ PyOS_InitInterrupts()
{ {
} }
void
PyOS_FiniInterrupts()
{
}
int int
PyOS_InterruptOccurred() PyOS_InterruptOccurred()
{ {
...@@ -81,6 +86,11 @@ PyOS_InitInterrupts() ...@@ -81,6 +86,11 @@ PyOS_InitInterrupts()
_go32_want_ctrl_break(1 /* TRUE */); _go32_want_ctrl_break(1 /* TRUE */);
} }
void
PyOS_FiniInterrupts()
{
}
int int
PyOS_InterruptOccurred() PyOS_InterruptOccurred()
{ {
...@@ -96,6 +106,11 @@ PyOS_InitInterrupts() ...@@ -96,6 +106,11 @@ PyOS_InitInterrupts()
{ {
} }
void
PyOS_FiniInterrupts()
{
}
int int
PyOS_InterruptOccurred() PyOS_InterruptOccurred()
{ {
...@@ -170,10 +185,12 @@ intcatcher(sig) ...@@ -170,10 +185,12 @@ intcatcher(sig)
Py_AddPendingCall(PyErr_CheckSignals, NULL); Py_AddPendingCall(PyErr_CheckSignals, NULL);
} }
static RETSIGTYPE (*old_siginthandler)() = SIG_DFL;
void void
PyOS_InitInterrupts() PyOS_InitInterrupts()
{ {
if (signal(SIGINT, SIG_IGN) != SIG_IGN) if ((old_siginthandler = signal(SIGINT, SIG_IGN)) != SIG_IGN)
signal(SIGINT, intcatcher); signal(SIGINT, intcatcher);
#ifdef HAVE_SIGINTERRUPT #ifdef HAVE_SIGINTERRUPT
/* This is for SunOS and other modern BSD derivatives. /* This is for SunOS and other modern BSD derivatives.
...@@ -186,6 +203,12 @@ PyOS_InitInterrupts() ...@@ -186,6 +203,12 @@ PyOS_InitInterrupts()
#endif /* HAVE_SIGINTERRUPT */ #endif /* HAVE_SIGINTERRUPT */
} }
void
PyOS_FiniInterrupts()
{
signal(SIGINT, old_siginthandler);
}
int int
PyOS_InterruptOccurred() PyOS_InterruptOccurred()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment