diff options
author | Guido van Rossum <guido@python.org> | 1997-11-19 16:15:37 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-19 16:15:37 (GMT) |
commit | 858cb73bb2643b73f4262857c865db285280e900 (patch) | |
tree | d52eced1707046d1f34cd119e4745744e5e937a9 /Python | |
parent | df9db1ea1882bc4274a005415c48d255df9c43d5 (diff) | |
download | cpython-858cb73bb2643b73f4262857c865db285280e900.zip cpython-858cb73bb2643b73f4262857c865db285280e900.tar.gz cpython-858cb73bb2643b73f4262857c865db285280e900.tar.bz2 |
Two changes (here we go again :-( ).
1) The __builtins__ variable in the __main__ module is set to the
__builtin__ module instead of its __dict__.
2) Get rid of the SIGHUP and SIGTERM handlers. They can't be made to
work reliably when threads may be in use, they are Unix specific, and
Python programmers can now program this functionality is a safer way
using the signal module.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonrun.c | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 381c987..bfed548 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -373,8 +373,9 @@ initmain() Py_FatalError("can't create __main__ module"); d = PyModule_GetDict(m); if (PyDict_GetItemString(d, "__builtins__") == NULL) { - if (PyDict_SetItemString(d, "__builtins__", - PyEval_GetBuiltins())) + PyObject *bimod = PyImport_ImportModule("__builtin__"); + if (bimod == NULL || + PyDict_SetItemString(d, "__builtins__", bimod) != 0) Py_FatalError("can't add __builtins__ to __main__"); } } @@ -1060,46 +1061,13 @@ Py_Exit(sts) #endif } -#ifdef HAVE_SIGNAL_H -static RETSIGTYPE -sighandler(sig) - int sig; -{ - signal(sig, SIG_DFL); /* Don't catch recursive signals */ - /* Do essential exit processing only */ - call_sys_exitfunc(); - call_ll_exitfuncs(); -#ifdef HAVE_KILL - kill(getpid(), sig); /* Pretend the signal killed us */ -#else - exit(1); -#endif - /*NOTREACHED*/ -} -#endif - static void initsigs() { - RETSIGTYPE (*t)(); #ifdef HAVE_SIGNAL_H #ifdef SIGPIPE signal(SIGPIPE, SIG_IGN); #endif -#ifdef SIGHUP - t = signal(SIGHUP, SIG_IGN); - if (t == SIG_DFL) - signal(SIGHUP, sighandler); - else - signal(SIGHUP, t); -#endif -#ifdef SIGTERM - t = signal(SIGTERM, SIG_IGN); - if (t == SIG_DFL) - signal(SIGTERM, sighandler); - else - signal(SIGTERM, t); -#endif #endif /* HAVE_SIGNAL_H */ PyOS_InitInterrupts(); /* May imply initsignal() */ } |