Don't reexport Py_hash_t and Py_ssize_t

This commit is contained in:
messense 2017-06-24 22:36:45 +08:00
parent 378fae9659
commit 4e836cb229
No known key found for this signature in database
GPG Key ID: BB41A8A2C716CCA9
4 changed files with 4 additions and 5 deletions

View File

@ -169,7 +169,7 @@ impl PyBuffer {
unsafe {
ffi::PyBuffer_GetPointer(
&*self.0 as *const ffi::Py_buffer as *mut ffi::Py_buffer,
indices.as_ptr() as *mut usize as *mut ::Py_ssize_t
indices.as_ptr() as *mut usize as *mut ffi::Py_ssize_t
)
}
}
@ -577,7 +577,7 @@ mod test {
#[test]
fn test_compatible_size() {
// for the cast in PyBuffer::shape()
assert_eq!(std::mem::size_of::<::Py_ssize_t>(), std::mem::size_of::<usize>());
assert_eq!(std::mem::size_of::<::ffi::Py_ssize_t>(), std::mem::size_of::<usize>());
}
#[test]

View File

@ -134,7 +134,7 @@ macro_rules! py_ssizearg_func {
($trait:ident, $class:ident :: $f:ident, $res_type:ty, $conv:expr) => {{
#[allow(unused_mut)]
unsafe extern "C" fn wrap<T>(slf: *mut ffi::PyObject,
arg: $crate::Py_ssize_t) -> *mut $crate::ffi::PyObject
arg: $crate::ffi::Py_ssize_t) -> *mut $crate::ffi::PyObject
where T: for<'p> $trait<'p> + $crate::PyDowncastFrom
{
const LOCATION: &'static str = concat!(stringify!($class), ".", stringify!($f), "()");

View File

@ -152,7 +152,6 @@ pub mod ffi {
pub use ffi3::*;
}
pub use ffi::{Py_ssize_t, Py_hash_t};
pub use err::{PyErr, PyResult, PyDowncastError, ToPyErr};
pub use objects::*;
pub use objectprotocol::ObjectProtocol;

View File

@ -85,7 +85,7 @@ pub trait ObjectProtocol {
/// Retrieves the hash code of the object.
/// This is equivalent to the Python expression: 'hash(self)'
fn hash(&self) -> PyResult<::Py_hash_t>;
fn hash(&self) -> PyResult<ffi::Py_hash_t>;
/// Returns whether the object is considered to be true.
/// This is equivalent to the Python expression: 'not not self'