Beispiel #1
0
static PyObject *
cframe_setstate(PyObject *self, PyObject *args)
{
	PyCFrameObject *cf = (PyCFrameObject *) self;
	int valid;
	PyObject *exec_name = NULL;
	PyFrame_ExecFunc *good_func, *bad_func;
	PyObject *params;
	int i, n;

        if (!PyArg_ParseTuple (args, cframetuplenewfmt,
			       &valid,
			       &exec_name,
			       &PyTuple_Type, &params,
			       &i,
			       &n))
	        return NULL;
    
	if (slp_find_execfuncs(cf->ob_type, exec_name, &good_func, &bad_func))
		return NULL;

        if (PyTuple_GET_SIZE(params)-1 != 3)
		VALUE_ERROR("bad argument for cframe unpickling", NULL);

	/* mark this frame as coming from unpickling */
	Py_INCREF(Py_None);
	cf->f_back = (PyFrameObject *) Py_None;
	cf->f_execute = valid ? good_func : bad_func;
	slp_from_tuple_with_nulls(&cf->ob1, params);
	cf->i = i;
	cf->n = n;
	Py_INCREF(cf);
	return (PyObject *) cf;
}
Beispiel #2
0
static PyObject *
bomb_setstate(PyBombObject *bomb, PyObject *args)
{
	if (PyTuple_GET_SIZE(args) != 4)
		VALUE_ERROR("bad exception tuple for bomb", NULL);
	bomb_clear(bomb);
	slp_from_tuple_with_nulls(&bomb->curexc_type, args);
	Py_INCREF(bomb);
	return (PyObject *) bomb;
}