Merge pull request #1255 from aviramha/add_profiling_functions
Add PyEval_SetProfile, PyEval_SetTrace
This commit is contained in:
commit
33a602d76a
|
@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
|
||||
### Added
|
||||
- Add argument names to `TypeError` messages generated by pymethod wrappers. [#1212](https://github.com/PyO3/pyo3/pull/1212)
|
||||
- Add `PyEval_SetProfile` and `PyEval_SetTrace` to FFI. [#1255](https://github.com/PyO3/pyo3/pull/1255)
|
||||
|
||||
### Changed
|
||||
- Change `PyIterator` to be consistent with other native types: it is now used as `&PyIterator` instead of `PyIterator<'a>`. [#1176](https://github.com/PyO3/pyo3/pull/1176)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::ffi::code::FreeFunc;
|
||||
use crate::ffi::object::PyObject;
|
||||
use crate::ffi::pystate::PyThreadState;
|
||||
use crate::ffi::pystate::{PyThreadState, Py_tracefunc};
|
||||
use std::os::raw::{c_char, c_int, c_void};
|
||||
|
||||
extern "C" {
|
||||
|
@ -67,6 +67,8 @@ extern "C" {
|
|||
pub fn PyEval_SaveThread() -> *mut PyThreadState;
|
||||
#[cfg_attr(PyPy, link_name = "PyPyEval_RestoreThread")]
|
||||
pub fn PyEval_RestoreThread(arg1: *mut PyThreadState);
|
||||
pub fn PyEval_SetProfile(trace_func: Py_tracefunc, arg1: *mut PyObject);
|
||||
pub fn PyEval_SetTrace(trace_func: Py_tracefunc, arg1: *mut PyObject);
|
||||
}
|
||||
|
||||
#[cfg(py_sys_config = "WITH_THREAD")]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::ffi::ceval::_PyFrameEvalFunction;
|
||||
use crate::ffi::frameobject::PyFrameObject;
|
||||
use crate::ffi::moduleobject::PyModuleDef;
|
||||
use crate::ffi::object::PyObject;
|
||||
use std::os::raw::{c_int, c_long};
|
||||
|
@ -67,3 +68,10 @@ extern "C" {
|
|||
pub unsafe fn PyThreadState_GET() -> *mut PyThreadState {
|
||||
PyThreadState_Get()
|
||||
}
|
||||
|
||||
pub type Py_tracefunc = extern "C" fn(
|
||||
obj: *mut PyObject,
|
||||
frame: *mut PyFrameObject,
|
||||
what: c_int,
|
||||
arg: *mut PyObject,
|
||||
) -> c_int;
|
||||
|
|
Loading…
Reference in New Issue