Remove PyNoArgsFunction

This commit is contained in:
David Hewitt 2020-01-22 16:27:36 +00:00
parent d2174c2ead
commit 43df3299ab
4 changed files with 4 additions and 6 deletions

View file

@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Removed
* `PyRef`, `PyRefMut`, `PyRawObject` [#683](https://github.com/PyO3/pyo3/pull/683)
* `PyNoArgsFunction` [#741](https://github.com/PyO3/pyo3/pull/741)
## [0.8.5]

View file

@ -75,7 +75,8 @@ fn impl_wrap_common(
if spec.args.is_empty() && noargs {
quote! {
unsafe extern "C" fn __wrap(
_slf: *mut pyo3::ffi::PyObject
_slf: *mut pyo3::ffi::PyObject,
_args: *mut pyo3::ffi::PyObject,
) -> *mut pyo3::ffi::PyObject
{
const _LOCATION: &'static str = concat!(
@ -525,7 +526,7 @@ pub fn impl_py_method_def(spec: &FnSpec, wrapper: &TokenStream) -> TokenStream {
pyo3::class::PyMethodDef {
ml_name: stringify!(#python_name),
ml_meth: pyo3::class::PyMethodType::PyNoArgsFunction(__wrap),
ml_meth: pyo3::class::PyMethodType::PyCFunction(__wrap),
ml_flags: pyo3::ffi::METH_NOARGS,
ml_doc: #doc,
}

View file

@ -28,7 +28,6 @@ pub enum PyMethodDefType {
pub enum PyMethodType {
PyCFunction(ffi::PyCFunction),
PyCFunctionWithKeywords(ffi::PyCFunctionWithKeywords),
PyNoArgsFunction(ffi::PyNoArgsFunction),
PyNewFunc(ffi::newfunc),
PyInitFunc(ffi::initproc),
}
@ -71,7 +70,6 @@ impl PyMethodDef {
let meth = match self.ml_meth {
PyMethodType::PyCFunction(meth) => meth,
PyMethodType::PyCFunctionWithKeywords(meth) => unsafe { std::mem::transmute(meth) },
PyMethodType::PyNoArgsFunction(meth) => unsafe { std::mem::transmute(meth) },
PyMethodType::PyNewFunc(meth) => unsafe { std::mem::transmute(meth) },
PyMethodType::PyInitFunc(meth) => unsafe { std::mem::transmute(meth) },
};

View file

@ -61,8 +61,6 @@ pub type PyCFunctionWithKeywords = unsafe extern "C" fn(
kwds: *mut PyObject,
) -> *mut PyObject;
pub type PyNoArgsFunction = unsafe extern "C" fn(slf: *mut PyObject) -> *mut PyObject;
#[cfg_attr(windows, link(name = "pythonXY"))]
extern "C" {
#[cfg_attr(PyPy, link_name = "PyPyCFunction_GetFunction")]