[Python-checkins] r50738 - in python/branches/bcannon-sandboxing: Lib/test/test_sys.py Python/sysmodule.c
Neal Norwitz
nnorwitz at gmail.com
Fri Jul 21 05:37:11 CEST 2006
> Modified: python/branches/bcannon-sandboxing/Python/sysmodule.c
> ==============================================================================
> --- python/branches/bcannon-sandboxing/Python/sysmodule.c (original)
> +++ python/branches/bcannon-sandboxing/Python/sysmodule.c Thu Jul 20 23:35:05 2006
> @@ -700,6 +700,64 @@
> 10. Number of stack pops performed by call_function()"
> );
>
> +#ifdef Py_MEMORY_CAP
> +static PyObject *
> +sys_setmemorycap(PyObject *self, PyObject *arg)
> +{
> + PyInterpreterState *interp = PyInterpreterState_SafeGet();
> + PY_LONG_LONG new_memory_cap;
> + PyObject *arg_as_long = PyNumber_Long(arg);
> +
> + if (!arg_as_long)
> + return NULL;
> +
> + new_memory_cap = PyLong_AsLongLong(arg_as_long);
> + Py_DECREF(arg_as_long); /* DEAD: arg_as_long */
if (new_memory_cap == -1)
return NULL;
> +
> + if (!interp)
> + Py_FatalError("interpreter not available");
> +
> + if (!PyInterpreterState_SetMemoryCap(interp, new_memory_cap))
> + return NULL;
> +
> + Py_RETURN_NONE;
> +}
More information about the Python-checkins
mailing list