summaryrefslogtreecommitdiffstats
path: root/Include/cpython
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-03-13 15:39:12 (GMT)
committerGitHub <noreply@github.com>2020-03-13 15:39:12 (GMT)
commit309d7cc5df4e2bf3086c49eb2b1b56b929554500 (patch)
tree18fefb154766c2c568ae128f42b115090f7d05eb /Include/cpython
parent9ee88cde1abf7f274cc55a0571b1c2cdb1263743 (diff)
downloadcpython-309d7cc5df4e2bf3086c49eb2b1b56b929554500.zip
cpython-309d7cc5df4e2bf3086c49eb2b1b56b929554500.tar.gz
cpython-309d7cc5df4e2bf3086c49eb2b1b56b929554500.tar.bz2
bpo-35370: Add _PyEval_SetTrace() function (GH-18975)
* sys.settrace(), sys.setprofile() and _lsprof.Profiler.enable() now properly report PySys_Audit() error if "sys.setprofile" or "sys.settrace" audit event is denied. * Add _PyEval_SetProfile() and _PyEval_SetTrace() function: similar to PyEval_SetProfile() and PyEval_SetTrace() but take a tstate parameter and return -1 on error. * Add _PyObject_FastCallTstate() function.
Diffstat (limited to 'Include/cpython')
-rw-r--r--Include/cpython/abstract.h8
-rw-r--r--Include/cpython/ceval.h2
2 files changed, 9 insertions, 1 deletions
diff --git a/Include/cpython/abstract.h b/Include/cpython/abstract.h
index c0b0182..48cf25c 100644
--- a/Include/cpython/abstract.h
+++ b/Include/cpython/abstract.h
@@ -142,12 +142,18 @@ PyAPI_FUNC(PyObject *) PyObject_VectorcallDict(
"tuple" and keyword arguments "dict". "dict" may also be NULL */
PyAPI_FUNC(PyObject *) PyVectorcall_Call(PyObject *callable, PyObject *tuple, PyObject *dict);
+static inline PyObject *
+_PyObject_FastCallTstate(PyThreadState *tstate, PyObject *func, PyObject *const *args, Py_ssize_t nargs)
+{
+ return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
+}
+
/* Same as PyObject_Vectorcall except without keyword arguments */
static inline PyObject *
_PyObject_FastCall(PyObject *func, PyObject *const *args, Py_ssize_t nargs)
{
PyThreadState *tstate = PyThreadState_GET();
- return _PyObject_VectorcallTstate(tstate, func, args, (size_t)nargs, NULL);
+ return _PyObject_FastCallTstate(tstate, func, args, nargs);
}
/* Call a callable without any arguments
diff --git a/Include/cpython/ceval.h b/Include/cpython/ceval.h
index 00c7499..7459937 100644
--- a/Include/cpython/ceval.h
+++ b/Include/cpython/ceval.h
@@ -7,7 +7,9 @@ extern "C" {
#endif
PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *);
+PyAPI_DATA(int) _PyEval_SetProfile(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *);
+PyAPI_FUNC(int) _PyEval_SetTrace(PyThreadState *tstate, Py_tracefunc func, PyObject *arg);
PyAPI_FUNC(int) _PyEval_GetCoroutineOriginTrackingDepth(void);
PyAPI_FUNC(void) _PyEval_SetAsyncGenFirstiter(PyObject *);
PyAPI_FUNC(PyObject *) _PyEval_GetAsyncGenFirstiter(void);