ffi cleanup: deprecate some nonexistent functions
This commit is contained in:
parent
edaf35c1ea
commit
67e1755f9c
|
@ -8,13 +8,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
## Unreleased
|
||||
### Added
|
||||
- Add FFI definition `PyCFunction_CheckExact` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- Add FFI definition `Py_IS_TYPE`.
|
||||
|
||||
### Changed
|
||||
- Deprecate FFI definition `PyCFunction_Call` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- Deprecate FFI definitions `PyModule_GetFilename`, `PyMethodDef_INIT`. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- Deprecate FFI definitions `PyObject_Check`, `PySuper_Check`, `FreeFunc`.
|
||||
|
||||
### Fixed
|
||||
- Remove FFI definition `PyCFunction_ClearFreeList` for Python 3.9 and later. [#1425](https://github.com/PyO3/pyo3/pull/1425)
|
||||
- Fix FFI definition `_PyEval_RequestCodeExtraIndex` which took an argument of the wrong type.
|
||||
|
||||
## [0.13.2] - 2021-02-12
|
||||
### Packaging
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
#[cfg(not(Py_LIMITED_API))]
|
||||
use crate::ffi::object::FreeFunc;
|
||||
use crate::ffi::object::PyObject;
|
||||
use crate::ffi::object::{freefunc, PyObject};
|
||||
use crate::ffi::pystate::Py_tracefunc;
|
||||
use std::os::raw::c_int;
|
||||
|
||||
|
@ -9,8 +7,7 @@ extern "C" {
|
|||
arg1: *mut crate::ffi::PyFrameObject,
|
||||
exc: c_int,
|
||||
) -> *mut PyObject;
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
pub fn _PyEval_RequestCodeExtraIndex(func: FreeFunc) -> c_int;
|
||||
pub fn _PyEval_RequestCodeExtraIndex(func: freefunc) -> c_int;
|
||||
pub fn PyEval_SetProfile(trace_func: Py_tracefunc, arg1: *mut PyObject);
|
||||
pub fn PyEval_SetTrace(trace_func: Py_tracefunc, arg1: *mut PyObject);
|
||||
}
|
||||
|
|
|
@ -526,16 +526,16 @@ pub unsafe fn PyType_CheckExact(op: *mut PyObject) -> c_int {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
// #[deprecated(note = "not present in Python headers; to be removed")]
|
||||
#[deprecated(note = "not present in Python headers; to be removed")]
|
||||
pub fn PyObject_Check(_arg1: *mut PyObject) -> c_int {
|
||||
1
|
||||
}
|
||||
|
||||
#[inline]
|
||||
// #[deprecated(note = "not present in Python headers; to be removed")]
|
||||
#[deprecated(note = "not present in Python headers; to be removed")]
|
||||
pub fn PySuper_Check(_arg1: *mut PyObject) -> c_int {
|
||||
0
|
||||
}
|
||||
|
||||
// #[deprecated(note = "not present in Python headers; to be removed")]
|
||||
#[deprecated(note = "not present in Python headers; to be removed")]
|
||||
pub type FreeFunc = extern "C" fn(*mut c_void) -> c_void;
|
||||
|
|
|
@ -48,12 +48,19 @@ impl crate::AsPyPointer for PyAny {
|
|||
unsafe impl crate::type_object::PyLayout<PyAny> for ffi::PyObject {}
|
||||
impl crate::type_object::PySizedLayout<PyAny> for ffi::PyObject {}
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
// Copied here as the macro does not accept deprecated functions.
|
||||
// Originally ffi::object::PyObject_Check, but this is not in the Python C API.
|
||||
fn PyObject_Check(_: *mut ffi::PyObject) -> c_int {
|
||||
1
|
||||
}
|
||||
|
||||
pyobject_native_type_info!(
|
||||
PyAny,
|
||||
ffi::PyObject,
|
||||
ffi::PyBaseObject_Type,
|
||||
Some("builtins"),
|
||||
ffi::PyObject_Check
|
||||
PyObject_Check
|
||||
);
|
||||
|
||||
pyobject_native_type_extract!(PyAny);
|
||||
|
|
Loading…
Reference in a new issue