From 6d80ee06794e9a1cc7de9af0d4aa9c2610be4638 Mon Sep 17 00:00:00 2001 From: konstin Date: Wed, 17 Apr 2019 19:06:12 +0200 Subject: [PATCH] Properly scope libc to fix #442 Apparently we can't add a test for that because the test crates have libc in scope --- pyo3-derive-backend/src/pymethod.rs | 4 ++-- src/lib.rs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pyo3-derive-backend/src/pymethod.rs b/pyo3-derive-backend/src/pymethod.rs index 010e0c0e..a44090b8 100644 --- a/pyo3-derive-backend/src/pymethod.rs +++ b/pyo3-derive-backend/src/pymethod.rs @@ -182,7 +182,7 @@ fn impl_wrap_init(cls: &syn::Type, name: &syn::Ident, spec: &FnSpec<'_>) -> Toke unsafe extern "C" fn __wrap( _slf: *mut pyo3::ffi::PyObject, _args: *mut pyo3::ffi::PyObject, - _kwargs: *mut pyo3::ffi::PyObject) -> libc::c_int + _kwargs: *mut pyo3::ffi::PyObject) -> pyo3::libc::c_int { const _LOCATION: &'static str = concat!(stringify!(#cls),".",stringify!(#name),"()"); let _pool = pyo3::GILPool::new(); @@ -305,7 +305,7 @@ pub(crate) fn impl_wrap_setter( #[allow(unused_mut)] unsafe extern "C" fn __wrap( _slf: *mut pyo3::ffi::PyObject, - _value: *mut pyo3::ffi::PyObject, _: *mut ::std::os::raw::c_void) -> libc::c_int + _value: *mut pyo3::ffi::PyObject, _: *mut ::std::os::raw::c_void) -> pyo3::libc::c_int { const _LOCATION: &'static str = concat!(stringify!(#cls),".",stringify!(#name),"()"); let _pool = pyo3::GILPool::new(); diff --git a/src/lib.rs b/src/lib.rs index 8c0f8ca1..6be9a6cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -130,12 +130,15 @@ pub use crate::objectprotocol::ObjectProtocol; pub use crate::python::{prepare_freethreaded_python, Python}; pub use crate::type_object::{PyObjectAlloc, PyRawObject, PyTypeInfo}; -// We need that reexport for wrap_function +// Re-exported for wrap_function #[doc(hidden)] pub use mashup; -// We need that reexport for pymethods +// Re-exported for pymethods #[doc(hidden)] pub use inventory; +// Re-exported for the `__wrap` functions +#[doc(hidden)] +pub use libc; /// Raw ffi declarations for the c interface of python pub mod ffi;