From 43df3299abc3cfdf006914c44d5b7f3d0a987f6c Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Wed, 22 Jan 2020 16:27:36 +0000 Subject: [PATCH] Remove `PyNoArgsFunction` --- CHANGELOG.md | 1 + pyo3-derive-backend/src/pymethod.rs | 5 +++-- src/class/methods.rs | 2 -- src/ffi/methodobject.rs | 2 -- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 087624aea8c..9c1277c410a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] diff --git a/pyo3-derive-backend/src/pymethod.rs b/pyo3-derive-backend/src/pymethod.rs index e7af4967de7..97bb1f161f0 100644 --- a/pyo3-derive-backend/src/pymethod.rs +++ b/pyo3-derive-backend/src/pymethod.rs @@ -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, } diff --git a/src/class/methods.rs b/src/class/methods.rs index f52a50ce6e9..acfaebf33b5 100644 --- a/src/class/methods.rs +++ b/src/class/methods.rs @@ -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) }, }; diff --git a/src/ffi/methodobject.rs b/src/ffi/methodobject.rs index fadcdf0763c..a9d3936b300 100644 --- a/src/ffi/methodobject.rs +++ b/src/ffi/methodobject.rs @@ -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")]