import os
import sys
+import signal
import getopt
import random
import warnings
if single and fromfile:
usage(2, "-s and -f don't go together!")
+ def handle_signal(*args):
+ raise RuntimeError('signal received %s' % args)
+
+ # Provide a traceback if we are terminated.
+ signal.signal(signal.SIGTERM, handle_signal)
+
good = []
bad = []
skipped = []
StgDictObject *idict;
if (adict && adict->proto) {
idict = PyType_stgdict(adict->proto);
+ if (!idict) {
+ PyErr_SetString(PyExc_TypeError,
+ "has no _stginfo_");
+ Py_DECREF(self);
+ return NULL;
+ }
if (idict->getfunc == getentry("c")->getfunc) {
struct fielddesc *fd = getentry("s");
getfunc = fd->getfunc;
Py_ssize_t nk, nd;
argdefs = PyFunction_GET_DEFAULTS(func);
+ /* XXX(nnorwitz): don't we know argdefs is either NULL or a tuple? */
if (argdefs != NULL && PyTuple_Check(argdefs)) {
d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0);
- nd = PyTuple_Size(argdefs);
+ nd = PyTuple_GET_SIZE(argdefs);
}
else {
d = NULL;
result = PyEval_EvalCodeEx(
(PyCodeObject *)PyFunction_GET_CODE(func),
PyFunction_GET_GLOBALS(func), (PyObject *)NULL,
- &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg),
+ &PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg),
k, nk, d, nd,
PyFunction_GET_CLOSURE(func));
main_thread = PyThread_get_thread_ident();
}
+void
+_PyEval_FiniThreads(void)
+{
+ if (interpreter_lock)
+ PyThread_free_lock(interpreter_lock);
+ interpreter_lock = 0;
+ main_thread = 0;
+}
+
void
PyEval_AcquireLock(void)
{
static void call_ll_exitfuncs(void);
extern void _PyUnicode_Init(void);
extern void _PyUnicode_Fini(void);
+extern void _PyEval_FiniThreads(void);
#ifdef WITH_THREAD
extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *);
_PyUnicode_Fini();
#endif
+ _PyEval_FiniThreads();
+
/* XXX Still allocated:
- various static ad-hoc pointers to interned strings
- int and float free list blocks