public PyObject getprofile() { ThreadState ts = Py.getThreadState(); if (ts.profilefunc == null) { return Py.None; } else { return ((PythonTraceFunction)ts.profilefunc).tracefunc; } }
public PyObject gettrace() { ThreadState ts = Py.getThreadState(); if (ts.tracefunc == null) { return Py.None; } else { return ((PythonTraceFunction)ts.tracefunc).tracefunc; } }
public static final PySystemState setSystemState(PySystemState newSystemState) { ThreadState ts = getThreadState(newSystemState); PySystemState oldSystemState = ts.systemState; if (oldSystemState != newSystemState) { //XXX: should we make this a real warning? //System.err.println("Warning: changing systemState "+ // "for same thread!"); ts.systemState = newSystemState; } return oldSystemState; }
public static PyFrame getFrame() { ThreadState ts = getThreadState(); if (ts == null) { return null; } return ts.frame; }
public static final PySystemState getSystemState() { return getThreadState().systemState; //defaultSystemState; }
public void settrace(PyObject tracefunc) { ThreadState ts = Py.getThreadState(); if (tracefunc == Py.None) { ts.tracefunc = null; } else { ts.tracefunc = new PythonTraceFunction(tracefunc); } }
@Override public PyObject __call__(PyObject arg0, PyObject arg1, PyObject arg2, PyObject arg3) { return __call__(Py.getThreadState(), arg0, arg1, arg2, arg3); }
public void setprofile(PyObject profilefunc) { ThreadState ts = Py.getThreadState(); if (profilefunc == Py.None) { ts.profilefunc = null; } else { ts.profilefunc = new PythonTraceFunction(profilefunc); } }
@Override public PyObject __call__(PyObject arg1, PyObject arg2) { return __call__(Py.getThreadState(), arg1, arg2); }
@Override public PyObject __call__() { return __call__(Py.getThreadState()); }
@Override public PyObject __call__(PyObject arg) { return __call__(Py.getThreadState(), arg); }
@Override public PyObject __call__(PyObject arg1, PyObject arg2, PyObject arg3) { return __call__(Py.getThreadState(), arg1, arg2, arg3); }
@Override public PyObject __call__(PyObject[] args, String[] keywords) { return __call__(Py.getThreadState(), args, keywords); }
@Override public PyObject __call__() { return __call__(Py.getThreadState()); }
@Override public PyObject __call__(PyObject arg1, PyObject[] args, String[] keywords) { return __call__(Py.getThreadState(), arg1, args, keywords); }
@Override public PyObject __call__(PyObject[] args) { return __call__(Py.getThreadState(), args); }
private PyObject doGetglobal(String index) { PyObject ret = f_globals.__finditem__(index); if (ret != null) { return ret; } // Set up f_builtins if not already set if (f_builtins == null) { f_builtins = Py.getThreadState().systemState.builtins; } return f_builtins.__finditem__(index); }
public static PyTuple exc_info() { PyException exc = Py.getThreadState().exception; if (exc == null) { return new PyTuple(Py.None, Py.None, Py.None); } PyObject tb = exc.traceback; PyObject value = exc.value; return new PyTuple(exc.type, value == null ? Py.None : value, tb == null ? Py.None : tb); }
public static PyException setException(Throwable t, PyFrame frame) { PyException pye = Py.JavaError(t); pye.normalize(); pye.tracebackHere(frame); getThreadState().exception = pye; return pye; }
public static PyObject makeClass(String name, PyObject[] bases, PyCode code, PyObject[] closure_cells) { ThreadState state = getThreadState(); PyObject dict = code.call(state, Py.EmptyObjects, Py.NoKeywords, state.frame.f_globals, Py.EmptyObjects, new PyTuple(closure_cells)); return makeClass(name, bases, dict); }