diff --git a/pyo3-derive-backend/src/py_class.rs b/pyo3-derive-backend/src/py_class.rs index da09a509..cab748fc 100644 --- a/pyo3-derive-backend/src/py_class.rs +++ b/pyo3-derive-backend/src/py_class.rs @@ -86,7 +86,7 @@ fn impl_class( let extra = if let Some(token) = token { Some(quote! { impl ::pyo3::PyObjectWithToken for #cls { - #[inline(always)] + #[inline] fn py<'p>(&'p self) -> ::pyo3::Python<'p> { self.#token.py() } @@ -243,7 +243,7 @@ fn impl_class( } impl ::pyo3::typeob::PyTypeObject for #cls { - #[inline(always)] + #[inline] fn init_type() { static START: std::sync::Once = std::sync::ONCE_INIT; START.call_once(|| { diff --git a/src/err.rs b/src/err.rs index 8023f108..8012ac8a 100644 --- a/src/err.rs +++ b/src/err.rs @@ -90,7 +90,7 @@ macro_rules! py_exception { } impl $crate::typeob::PyTypeObject for $name { - #[inline(always)] + #[inline] fn init_type() { let _ = $name::type_object(); } diff --git a/src/ffi/datetime.rs b/src/ffi/datetime.rs index ca525cb3..eb94902e 100644 --- a/src/ffi/datetime.rs +++ b/src/ffi/datetime.rs @@ -185,7 +185,7 @@ impl Deref for PyDateTimeAPI { } } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_IMPORT() -> &'static PyDateTime_CAPI { // PyDateTime_CAPSULE_NAME is a macro in C let PyDateTime_CAPSULE_NAME = CString::new("datetime.datetime_CAPI").unwrap(); @@ -202,52 +202,52 @@ pub unsafe fn PyDateTime_IMPORT() -> &'static PyDateTime_CAPI { // // Type Check macros // -#[inline(always)] +#[inline] pub unsafe fn PyDate_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, PyDateTimeAPI.DateType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDate_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == PyDateTimeAPI.DateType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, PyDateTimeAPI.DateTimeType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == PyDateTimeAPI.DateTimeType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyTime_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, PyDateTimeAPI.TimeType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyTime_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == PyDateTimeAPI.TimeType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDelta_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, PyDateTimeAPI.DeltaType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDelta_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == PyDateTimeAPI.DeltaType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyTZInfo_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, PyDateTimeAPI.TZInfoType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyTZInfo_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == PyDateTimeAPI.TZInfoType) as c_int } @@ -322,65 +322,65 @@ macro_rules! _PyDateTime_GET_TZINFO { } // Accessor functions for DateTime -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_HOUR(o: *mut PyObject) -> c_int { _PyDateTime_GET_HOUR!((o as *mut PyDateTime_DateTime), _PyDateTime_DATE_DATASIZE) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_MINUTE(o: *mut PyObject) -> c_int { _PyDateTime_GET_MINUTE!((o as *mut PyDateTime_DateTime), _PyDateTime_DATE_DATASIZE) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_SECOND(o: *mut PyObject) -> c_int { _PyDateTime_GET_SECOND!((o as *mut PyDateTime_DateTime), _PyDateTime_DATE_DATASIZE) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_MICROSECOND(o: *mut PyObject) -> c_int { _PyDateTime_GET_MICROSECOND!((o as *mut PyDateTime_DateTime), _PyDateTime_DATE_DATASIZE) } #[cfg(Py_3_6)] -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_FOLD(o: *mut PyObject) -> c_uchar { _PyDateTime_GET_FOLD!(o as *mut PyDateTime_DateTime) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DATE_GET_TZINFO(o: *mut PyObject) -> *mut PyObject { _PyDateTime_GET_TZINFO!(o as *mut PyDateTime_DateTime) } // Accessor functions for Time -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_HOUR(o: *mut PyObject) -> c_int { _PyDateTime_GET_HOUR!((o as *mut PyDateTime_Time), 0) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_MINUTE(o: *mut PyObject) -> c_int { _PyDateTime_GET_MINUTE!((o as *mut PyDateTime_Time), 0) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_SECOND(o: *mut PyObject) -> c_int { _PyDateTime_GET_SECOND!((o as *mut PyDateTime_Time), 0) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_MICROSECOND(o: *mut PyObject) -> c_int { _PyDateTime_GET_MICROSECOND!((o as *mut PyDateTime_Time), 0) } #[cfg(Py_3_6)] -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_FOLD(o: *mut PyObject) -> c_uchar { _PyDateTime_GET_FOLD!(o as *mut PyDateTime_Time) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_TIME_GET_TZINFO(o: *mut PyObject) -> *mut PyObject { _PyDateTime_GET_TZINFO!(o as *mut PyDateTime_Time) } @@ -392,17 +392,17 @@ macro_rules! _access_delta_field { }; } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DELTA_GET_DAYS(o: *mut PyObject) -> c_int { _access_delta_field!(o, days) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DELTA_GET_SECONDS(o: *mut PyObject) -> c_int { _access_delta_field!(o, seconds) } -#[inline(always)] +#[inline] pub unsafe fn PyDateTime_DELTA_GET_MICROSECONDS(o: *mut PyObject) -> c_int { _access_delta_field!(o, microseconds) } diff --git a/src/ffi/mod.rs b/src/ffi/mod.rs index 72bd6c3c..346857f7 100644 --- a/src/ffi/mod.rs +++ b/src/ffi/mod.rs @@ -1,5 +1,4 @@ #![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)] -#![cfg_attr(feature="cargo-clippy", allow(inline_always))] #[cfg(not(Py_3))] pub use ffi2::*; diff --git a/src/ffi2/boolobject.rs b/src/ffi2/boolobject.rs index 0248736f..2cb7553f 100644 --- a/src/ffi2/boolobject.rs +++ b/src/ffi2/boolobject.rs @@ -12,18 +12,18 @@ extern "C" { pub fn PyBool_FromLong(arg1: c_long) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PyBool_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyBool_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn Py_False() -> *mut PyObject { &mut _Py_ZeroStruct as *mut PyBoolObject as *mut PyObject } -#[inline(always)] +#[inline] pub unsafe fn Py_True() -> *mut PyObject { &mut _Py_TrueStruct as *mut PyBoolObject as *mut PyObject } diff --git a/src/ffi2/bufferobject.rs b/src/ffi2/bufferobject.rs index 7af2feec..7cc5a96b 100644 --- a/src/ffi2/bufferobject.rs +++ b/src/ffi2/bufferobject.rs @@ -7,7 +7,7 @@ extern "C" { pub static mut PyBuffer_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyBuffer_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyBuffer_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/bytearrayobject.rs b/src/ffi2/bytearrayobject.rs index 5dcd64b2..a86203b2 100644 --- a/src/ffi2/bytearrayobject.rs +++ b/src/ffi2/bytearrayobject.rs @@ -42,7 +42,7 @@ extern "C" { pub fn PyByteArray_Resize(bytearray: *mut PyObject, len: Py_ssize_t) -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyByteArray_AS_STRING(o: *mut PyObject) -> *mut c_char { PyByteArray_AsString(o) // #define PyByteArray_AS_STRING(self) \ @@ -50,7 +50,7 @@ pub unsafe fn PyByteArray_AS_STRING(o: *mut PyObject) -> *mut c_char { // Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string) } -#[inline(always)] +#[inline] pub unsafe fn PyByteArray_GET_SIZE(o: *mut PyObject) -> Py_ssize_t { // #define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self)) PyByteArray_Size(o) diff --git a/src/ffi2/cellobject.rs b/src/ffi2/cellobject.rs index 486f0bae..a74c3298 100644 --- a/src/ffi2/cellobject.rs +++ b/src/ffi2/cellobject.rs @@ -19,7 +19,7 @@ extern "C" { pub static mut PyCell_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCell_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCell_Type) as c_int } @@ -31,12 +31,12 @@ extern "C" { pub fn PyCell_Set(op: *mut PyObject, obj: *mut PyObject) -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyCell_GET(op: *mut PyObject) -> *mut PyObject { (*(op as *mut PyCellObject)).ob_ref } -#[inline(always)] +#[inline] pub unsafe fn PyCell_SET(op: *mut PyObject, obj: *mut PyObject) { (*(op as *mut PyCellObject)).ob_ref = obj; } diff --git a/src/ffi2/classobject.rs b/src/ffi2/classobject.rs index cf4132bc..92384371 100644 --- a/src/ffi2/classobject.rs +++ b/src/ffi2/classobject.rs @@ -56,19 +56,19 @@ extern "C" { pub static mut PyMethod_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyClass_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyClass_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyInstance_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyInstance_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyMethod_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyMethod_Type; (Py_TYPE(op) == u) as c_int @@ -100,17 +100,17 @@ extern "C" { pub fn PyMethod_ClearFreeList() -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyMethod_GET_FUNCTION(meth: *mut PyObject) -> *mut PyObject { (*(meth as *mut PyMethodObject)).im_func } -#[inline(always)] +#[inline] pub unsafe fn PyMethod_GET_SELF(meth: *mut PyObject) -> *mut PyObject { (*(meth as *mut PyMethodObject)).im_self } -#[inline(always)] +#[inline] pub unsafe fn PyMethod_GET_CLASS(meth: *mut PyObject) -> *mut PyObject { (*(meth as *mut PyMethodObject)).im_class } diff --git a/src/ffi2/cobject.rs b/src/ffi2/cobject.rs index 8c1ab3cd..60f7d55a 100644 --- a/src/ffi2/cobject.rs +++ b/src/ffi2/cobject.rs @@ -6,7 +6,7 @@ extern "C" { pub static mut PyCObject_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCObject_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCObject_Type) as c_int } diff --git a/src/ffi2/code.rs b/src/ffi2/code.rs index 80c5be19..baea6be3 100644 --- a/src/ffi2/code.rs +++ b/src/ffi2/code.rs @@ -88,7 +88,7 @@ extern "C" { ) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCode_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCode_Type) as c_int } diff --git a/src/ffi2/complexobject.rs b/src/ffi2/complexobject.rs index 48a9b032..f650c4de 100644 --- a/src/ffi2/complexobject.rs +++ b/src/ffi2/complexobject.rs @@ -37,12 +37,12 @@ extern "C" { pub static mut PyComplex_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyComplex_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyComplex_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyComplex_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyComplex_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/descrobject.rs b/src/ffi2/descrobject.rs index 5c92cca5..c2a6c3ee 100644 --- a/src/ffi2/descrobject.rs +++ b/src/ffi2/descrobject.rs @@ -86,7 +86,7 @@ extern "C" { ) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PyDescr_IsData(d: *mut PyObject) -> c_int { (*Py_TYPE(d)).tp_descr_set.is_some() as c_int } diff --git a/src/ffi2/dictobject.rs b/src/ffi2/dictobject.rs index ec043bdc..036b05c6 100644 --- a/src/ffi2/dictobject.rs +++ b/src/ffi2/dictobject.rs @@ -15,12 +15,12 @@ extern "C" { pub static mut PyDictValues_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyDict_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyDict_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyDict_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/fileobject.rs b/src/ffi2/fileobject.rs index 591d87e6..cfe881f3 100644 --- a/src/ffi2/fileobject.rs +++ b/src/ffi2/fileobject.rs @@ -7,12 +7,12 @@ extern "C" { pub static mut PyFile_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyFile_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyFile_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyFile_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyFile_Type) as c_int } diff --git a/src/ffi2/floatobject.rs b/src/ffi2/floatobject.rs index efc96e20..a07c65e6 100644 --- a/src/ffi2/floatobject.rs +++ b/src/ffi2/floatobject.rs @@ -19,12 +19,12 @@ extern "C" { pub static mut PyFloat_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyFloat_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyFloat_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyFloat_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyFloat_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/funcobject.rs b/src/ffi2/funcobject.rs index 36ed08d1..ce0c1b44 100644 --- a/src/ffi2/funcobject.rs +++ b/src/ffi2/funcobject.rs @@ -6,7 +6,7 @@ extern "C" { pub static mut PyFunction_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyFunction_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyFunction_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/genobject.rs b/src/ffi2/genobject.rs index 43c3c197..82004d7b 100644 --- a/src/ffi2/genobject.rs +++ b/src/ffi2/genobject.rs @@ -23,12 +23,12 @@ extern "C" { pub static mut PyGen_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyGen_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyGen_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyGen_Type) as c_int } diff --git a/src/ffi2/intobject.rs b/src/ffi2/intobject.rs index 25461132..921f8d37 100644 --- a/src/ffi2/intobject.rs +++ b/src/ffi2/intobject.rs @@ -20,12 +20,12 @@ extern "C" { pub static mut PyInt_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyInt_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_INT_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyInt_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyInt_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/iterobject.rs b/src/ffi2/iterobject.rs index 7f39f445..ee9e927a 100644 --- a/src/ffi2/iterobject.rs +++ b/src/ffi2/iterobject.rs @@ -10,12 +10,12 @@ extern "C" { pub fn PyCallIter_New(arg1: *mut PyObject, arg2: *mut PyObject) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PySeqIter_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PySeqIter_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyCallIter_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCallIter_Type) as c_int } diff --git a/src/ffi2/listobject.rs b/src/ffi2/listobject.rs index 6600aeb7..eefa4569 100644 --- a/src/ffi2/listobject.rs +++ b/src/ffi2/listobject.rs @@ -21,30 +21,30 @@ extern "C" { pub static mut PyList_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyList_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyList_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyList_Type; (Py_TYPE(op) == u) as c_int } // Macro, trading safety for speed -#[inline(always)] +#[inline] pub unsafe fn PyList_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObject { *(*(op as *mut PyListObject)).ob_item.offset(i as isize) } -#[inline(always)] +#[inline] pub unsafe fn PyList_GET_SIZE(op: *mut PyObject) -> Py_ssize_t { Py_SIZE(op) } /// Macro, *only* to be used to fill in brand new lists -#[inline(always)] +#[inline] pub unsafe fn PyList_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObject) { *(*(op as *mut PyListObject)).ob_item.offset(i as isize) = v; } diff --git a/src/ffi2/longobject.rs b/src/ffi2/longobject.rs index 8dd4a234..c2cf0a42 100644 --- a/src/ffi2/longobject.rs +++ b/src/ffi2/longobject.rs @@ -12,12 +12,12 @@ extern "C" { pub static mut PyLong_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyLong_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyLong_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyLong_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/memoryobject.rs b/src/ffi2/memoryobject.rs index 80dddcf4..667e0ac8 100644 --- a/src/ffi2/memoryobject.rs +++ b/src/ffi2/memoryobject.rs @@ -7,18 +7,18 @@ extern "C" { pub static mut PyMemoryView_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyMemoryView_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyMemoryView_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyMemoryView_GET_BUFFER(op: *mut PyObject) -> *mut Py_buffer { &mut (*(op as *mut PyMemoryViewObject)).view } -#[inline(always)] +#[inline] pub unsafe fn PyMemoryView_GET_BASE(op: *mut PyObject) -> *mut PyObject { (*(op as *mut PyMemoryViewObject)).view.obj } diff --git a/src/ffi2/methodobject.rs b/src/ffi2/methodobject.rs index 64912efa..973849ff 100644 --- a/src/ffi2/methodobject.rs +++ b/src/ffi2/methodobject.rs @@ -7,7 +7,7 @@ extern "C" { pub static mut PyCFunction_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCFunction_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyCFunction_Type; (Py_TYPE(op) == u) as c_int @@ -119,7 +119,7 @@ extern "C" { pub fn PyCFunction_ClearFreeList() -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject { PyCFunction_NewEx(ml, slf, ptr::null_mut()) } diff --git a/src/ffi2/mod.rs b/src/ffi2/mod.rs index 29a160a7..14b6a75d 100644 --- a/src/ffi2/mod.rs +++ b/src/ffi2/mod.rs @@ -132,13 +132,13 @@ pub const Py_file_input: c_int = 257; pub const Py_eval_input: c_int = 258; #[cfg(not(py_sys_config = "Py_USING_UNICODE"))] -#[inline(always)] +#[inline] pub fn PyUnicode_Check(op: *mut PyObject) -> libc::c_int { 0 } #[cfg(not(py_sys_config = "Py_USING_UNICODE"))] -#[inline(always)] +#[inline] pub fn PyUnicode_CheckExact(op: *mut PyObject) -> libc::c_int { 0 } diff --git a/src/ffi2/modsupport.rs b/src/ffi2/modsupport.rs index ba66fead..b915d4ca 100644 --- a/src/ffi2/modsupport.rs +++ b/src/ffi2/modsupport.rs @@ -95,7 +95,7 @@ pub const PYTHON_API_VERSION: c_int = 1013; target_pointer_width = "64", not(py_sys_config = "Py_TRACE_REFS") ))] -#[inline(always)] +#[inline] pub unsafe fn Py_InitModule4( name: *const c_char, methods: *mut PyMethodDef, @@ -107,7 +107,7 @@ pub unsafe fn Py_InitModule4( } #[cfg(all(target_pointer_width = "64", py_sys_config = "Py_TRACE_REFS"))] -#[inline(always)] +#[inline] pub unsafe fn Py_InitModule4( name: *const c_char, methods: *mut PyMethodDef, @@ -122,7 +122,7 @@ pub unsafe fn Py_InitModule4( not(target_pointer_width = "64"), py_sys_config = "Py_TRACE_REFS" ))] -#[inline(always)] +#[inline] pub unsafe fn Py_InitModule4( name: *const c_char, methods: *mut PyMethodDef, @@ -133,7 +133,7 @@ pub unsafe fn Py_InitModule4( Py_InitModule4TraceRefs(name, methods, doc, _self, apiver) } -#[inline(always)] +#[inline] pub unsafe fn Py_InitModule(name: *const c_char, methods: *mut PyMethodDef) -> *mut PyObject { Py_InitModule4( name, @@ -144,7 +144,7 @@ pub unsafe fn Py_InitModule(name: *const c_char, methods: *mut PyMethodDef) -> * ) } -#[inline(always)] +#[inline] pub unsafe fn Py_InitModule3( name: *const c_char, methods: *mut PyMethodDef, diff --git a/src/ffi2/moduleobject.rs b/src/ffi2/moduleobject.rs index 52546b18..fc6c3959 100644 --- a/src/ffi2/moduleobject.rs +++ b/src/ffi2/moduleobject.rs @@ -8,12 +8,12 @@ extern "C" { pub static mut PyModule_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyModule_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyModule_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyModule_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyModule_Type) as c_int } diff --git a/src/ffi2/object.rs b/src/ffi2/object.rs index be4fd28e..c9f88079 100644 --- a/src/ffi2/object.rs +++ b/src/ffi2/object.rs @@ -37,17 +37,17 @@ pub struct PyVarObject { pub ob_size: Py_ssize_t, } -#[inline(always)] +#[inline] pub unsafe fn Py_REFCNT(ob: *mut PyObject) -> Py_ssize_t { (*ob).ob_refcnt } -#[inline(always)] +#[inline] pub unsafe fn Py_TYPE(ob: *mut PyObject) -> *mut PyTypeObject { (*ob).ob_type } -#[inline(always)] +#[inline] pub unsafe fn Py_SIZE(ob: *mut PyObject) -> Py_ssize_t { (*(ob as *mut PyVarObject)).ob_size } @@ -564,7 +564,7 @@ extern "C" { pub fn PyType_IsSubtype(a: *mut PyTypeObject, b: *mut PyTypeObject) -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyObject_TypeCheck(ob: *mut PyObject, tp: *mut PyTypeObject) -> c_int { (Py_TYPE(ob) == tp || PyType_IsSubtype(Py_TYPE(ob), tp) != 0) as c_int } @@ -576,12 +576,12 @@ extern "C" { pub static mut PySuper_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyType_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyType_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == (&mut PyType_Type as *mut _)) as c_int } @@ -611,7 +611,7 @@ extern "C" { pub fn PyObject_Str(o: *mut PyObject) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PyObject_Bytes(o: *mut PyObject) -> *mut PyObject { PyObject_Str(o) } @@ -755,18 +755,18 @@ pub const Py_TPFLAGS_DEFAULT: c_long = (Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_INDEX | 0); -#[inline(always)] +#[inline] pub unsafe fn PyType_HasFeature(t: *mut PyTypeObject, f: c_long) -> c_int { (((*t).tp_flags & f) != 0) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyType_FastSubclass(t: *mut PyTypeObject, f: c_long) -> c_int { PyType_HasFeature(t, f) } // Reference counting macros. -#[inline(always)] +#[inline] pub unsafe fn Py_INCREF(op: *mut PyObject) { if cfg!(py_sys_config = "Py_REF_DEBUG") { Py_IncRef(op) @@ -775,7 +775,7 @@ pub unsafe fn Py_INCREF(op: *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_DECREF(op: *mut PyObject) { if cfg!(py_sys_config = "Py_REF_DEBUG") || cfg!(py_sys_config = "COUNT_ALLOCS") { Py_DecRef(op) @@ -787,7 +787,7 @@ pub unsafe fn Py_DECREF(op: *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_CLEAR(op: &mut *mut PyObject) { let tmp = *op; if !tmp.is_null() { @@ -796,14 +796,14 @@ pub unsafe fn Py_CLEAR(op: &mut *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_XINCREF(op: *mut PyObject) { if !op.is_null() { Py_INCREF(op) } } -#[inline(always)] +#[inline] pub unsafe fn Py_XDECREF(op: *mut PyObject) { if !op.is_null() { Py_DECREF(op) @@ -819,12 +819,12 @@ extern "C" { static mut _Py_NotImplementedStruct: PyObject; } -#[inline(always)] +#[inline] pub unsafe fn Py_None() -> *mut PyObject { &mut _Py_NoneStruct } -#[inline(always)] +#[inline] pub unsafe fn Py_NotImplemented() -> *mut PyObject { &mut _Py_NotImplementedStruct } @@ -855,7 +855,7 @@ extern "C" { pub const PyTrash_UNWIND_LEVEL: c_int = 50; -#[inline(always)] +#[inline] pub unsafe fn Py_TRASHCAN ()>(op: *mut PyObject, body: F) { let tstate = ffi2::pystate::PyThreadState_GET(); if tstate.is_null() || (*tstate).trash_delete_nesting < PyTrash_UNWIND_LEVEL { diff --git a/src/ffi2/objimpl.rs b/src/ffi2/objimpl.rs index e9342989..ff98af60 100644 --- a/src/ffi2/objimpl.rs +++ b/src/ffi2/objimpl.rs @@ -30,14 +30,14 @@ extern "C" { } /// Test if a type has a GC head -#[inline(always)] +#[inline] #[allow(unused_parens)] pub unsafe fn PyType_IS_GC(t: *mut PyTypeObject) -> c_int { PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) } /// Test if an object has a GC head -#[inline(always)] +#[inline] pub unsafe fn PyObject_IS_GC(o: *mut PyObject) -> c_int { (PyType_IS_GC(Py_TYPE(o)) != 0 && match (*Py_TYPE(o)).tp_is_gc { Some(tp_is_gc) => tp_is_gc(o) != 0, @@ -46,13 +46,13 @@ pub unsafe fn PyObject_IS_GC(o: *mut PyObject) -> c_int { } /* Test if a type supports weak references */ -#[inline(always)] +#[inline] #[allow(unused_parens)] pub unsafe fn PyType_SUPPORTS_WEAKREFS(t: *mut PyTypeObject) -> c_int { (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) != 0 && ((*t).tp_weaklistoffset > 0)) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyObject_GET_WEAKREFS_LISTPTR(o: *mut PyObject) -> *mut *mut PyObject { let weaklistoffset = (*Py_TYPE(o)).tp_weaklistoffset as isize; (o as *mut c_char).offset(weaklistoffset) as *mut *mut PyObject diff --git a/src/ffi2/pystate.rs b/src/ffi2/pystate.rs index eb2d5320..f17807b8 100644 --- a/src/ffi2/pystate.rs +++ b/src/ffi2/pystate.rs @@ -92,13 +92,13 @@ extern "C" { } #[cfg(py_sys_config = "Py_DEBUG")] -#[inline(always)] +#[inline] pub unsafe fn PyThreadState_GET() -> *mut PyThreadState { PyThreadState_Get() } #[cfg(not(py_sys_config = "Py_DEBUG"))] -#[inline(always)] +#[inline] pub unsafe fn PyThreadState_GET() -> *mut PyThreadState { _PyThreadState_Current } diff --git a/src/ffi2/rangeobject.rs b/src/ffi2/rangeobject.rs index 4674aac8..7153a802 100644 --- a/src/ffi2/rangeobject.rs +++ b/src/ffi2/rangeobject.rs @@ -6,7 +6,7 @@ extern "C" { pub static mut PyRange_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyRange_Check(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyRange_Type; (Py_TYPE(op) == u) as c_int diff --git a/src/ffi2/sliceobject.rs b/src/ffi2/sliceobject.rs index 8fa6c264..c3594da2 100644 --- a/src/ffi2/sliceobject.rs +++ b/src/ffi2/sliceobject.rs @@ -7,7 +7,7 @@ extern "C" { static mut _Py_EllipsisObject: PyObject; } -#[inline(always)] +#[inline] pub unsafe fn Py_Ellipsis() -> *mut PyObject { &mut _Py_EllipsisObject } @@ -32,7 +32,7 @@ extern "C" { pub static mut PyEllipsis_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PySlice_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PySlice_Type) as c_int } diff --git a/src/ffi2/stringobject.rs b/src/ffi2/stringobject.rs index 80fc742d..ca69720f 100644 --- a/src/ffi2/stringobject.rs +++ b/src/ffi2/stringobject.rs @@ -23,12 +23,12 @@ extern "C" { pub static mut PyString_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyString_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyBaseString_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass( Py_TYPE(op), @@ -36,18 +36,18 @@ pub unsafe fn PyBaseString_Check(op: *mut PyObject) -> c_int { ) } -#[inline(always)] +#[inline] pub unsafe fn PyString_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyString_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyString_GET_SIZE(op: *mut PyObject) -> Py_ssize_t { (*(op as *mut PyStringObject)).ob_size } -#[inline(always)] +#[inline] pub unsafe fn PyString_AS_STRING(op: *mut PyObject) -> *mut c_char { (*(op as *mut PyStringObject)).ob_sval.as_mut_ptr() } diff --git a/src/ffi2/traceback.rs b/src/ffi2/traceback.rs index 346e5771..2f98da2b 100644 --- a/src/ffi2/traceback.rs +++ b/src/ffi2/traceback.rs @@ -26,7 +26,7 @@ extern "C" { pub static mut PyTraceBack_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyTraceBack_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyTraceBack_Type) as c_int } diff --git a/src/ffi2/tupleobject.rs b/src/ffi2/tupleobject.rs index eed43b31..5b8eff7e 100644 --- a/src/ffi2/tupleobject.rs +++ b/src/ffi2/tupleobject.rs @@ -20,19 +20,19 @@ extern "C" { pub static mut PyTuple_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyTuple_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyTuple_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyTuple_Type; (Py_TYPE(op) == u) as c_int } // Macro, trading safety for speed -#[inline(always)] +#[inline] pub unsafe fn PyTuple_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObject { *(*(op as *mut PyTupleObject)) .ob_item @@ -40,13 +40,13 @@ pub unsafe fn PyTuple_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObjec .offset(i as isize) } -#[inline(always)] +#[inline] pub unsafe fn PyTuple_GET_SIZE(op: *mut PyObject) -> Py_ssize_t { Py_SIZE(op) } /// Macro, *only* to be used to fill in brand new tuples -#[inline(always)] +#[inline] pub unsafe fn PyTuple_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObject) { *(*(op as *mut PyTupleObject)) .ob_item diff --git a/src/ffi2/unicodeobject.rs b/src/ffi2/unicodeobject.rs index 0bb57d2a..bbd7add1 100644 --- a/src/ffi2/unicodeobject.rs +++ b/src/ffi2/unicodeobject.rs @@ -35,33 +35,33 @@ extern "C" { pub static mut PyUnicode_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_CheckExact(op: *mut PyObject) -> c_int { let u: *mut PyTypeObject = &mut PyUnicode_Type; (Py_TYPE(op) == u) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_GET_SIZE(o: *mut PyObject) -> Py_ssize_t { (*(o as *mut PyUnicodeObject)).length } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_GET_DATA_SIZE(o: *mut PyObject) -> Py_ssize_t { (*(o as *mut PyUnicodeObject)).length * Py_UNICODE_SIZE } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_AS_UNICODE(o: *mut PyObject) -> *mut Py_UNICODE { (*(o as *mut PyUnicodeObject)).data } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_AS_DATA(o: *mut PyObject) -> *const c_char { (*(o as *mut PyUnicodeObject)).data as *const c_char } @@ -642,31 +642,31 @@ extern "C" { fn _PyUnicodeUCS2_IsAlpha(ch: Py_UNICODE) -> c_int; } -#[inline(always)] +#[inline] #[cfg(py_sys_config = "Py_UNICODE_SIZE_4")] pub unsafe fn PyUnicode_FromStringAndSize(u: *const c_char, size: Py_ssize_t) -> *mut PyObject { PyUnicodeUCS4_FromStringAndSize(u, size) } -#[inline(always)] +#[inline] #[cfg(not(py_sys_config = "Py_UNICODE_SIZE_4"))] pub unsafe fn PyUnicode_FromStringAndSize(u: *const c_char, size: Py_ssize_t) -> *mut PyObject { PyUnicodeUCS2_FromStringAndSize(u, size) } -#[inline(always)] +#[inline] #[cfg(py_sys_config = "Py_UNICODE_SIZE_4")] pub unsafe fn PyUnicode_AsUTF8String(u: *mut PyObject) -> *mut PyObject { PyUnicodeUCS4_AsUTF8String(u) } -#[inline(always)] +#[inline] #[cfg(not(py_sys_config = "Py_UNICODE_SIZE_4"))] pub unsafe fn PyUnicode_AsUTF8String(u: *mut PyObject) -> *mut PyObject { PyUnicodeUCS2_AsUTF8String(u) } -#[inline(always)] +#[inline] #[cfg(py_sys_config = "Py_UNICODE_SIZE_4")] pub unsafe fn PyUnicode_FromEncodedObject( obj: *mut PyObject, @@ -676,7 +676,7 @@ pub unsafe fn PyUnicode_FromEncodedObject( PyUnicodeUCS4_FromEncodedObject(obj, encoding, errors) } -#[inline(always)] +#[inline] #[cfg(not(py_sys_config = "Py_UNICODE_SIZE_4"))] pub unsafe fn PyUnicode_FromEncodedObject( obj: *mut PyObject, diff --git a/src/ffi2/weakrefobject.rs b/src/ffi2/weakrefobject.rs index abf00b61..a1bd3e3c 100644 --- a/src/ffi2/weakrefobject.rs +++ b/src/ffi2/weakrefobject.rs @@ -25,23 +25,23 @@ extern "C" { static mut _PyWeakref_CallableProxyType: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckRef(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut _PyWeakref_RefType) } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckRefExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut _PyWeakref_RefType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckProxy(op: *mut PyObject) -> c_int { ((Py_TYPE(op) == &mut _PyWeakref_ProxyType) || (Py_TYPE(op) == &mut _PyWeakref_CallableProxyType)) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_Check(op: *mut PyObject) -> c_int { (PyWeakref_CheckRef(op) != 0 || PyWeakref_CheckProxy(op) != 0) as c_int } @@ -56,7 +56,7 @@ extern "C" { pub fn _PyWeakref_ClearRef(slf: *mut PyWeakReference); } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_GET_OBJECT(_ref: *mut PyObject) -> *mut PyObject { let obj = (*(_ref as *mut PyWeakReference)).wr_object; if Py_REFCNT(obj) > 0 { diff --git a/src/ffi3/boolobject.rs b/src/ffi3/boolobject.rs index 6949067c..0c669b2f 100644 --- a/src/ffi3/boolobject.rs +++ b/src/ffi3/boolobject.rs @@ -10,17 +10,17 @@ extern "C" { pub fn PyBool_FromLong(arg1: c_long) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PyBool_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyBool_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn Py_False() -> *mut PyObject { &mut _Py_FalseStruct as *mut PyLongObject as *mut PyObject } -#[inline(always)] +#[inline] pub unsafe fn Py_True() -> *mut PyObject { &mut _Py_TrueStruct as *mut PyLongObject as *mut PyObject } diff --git a/src/ffi3/bytearrayobject.rs b/src/ffi3/bytearrayobject.rs index 40799b40..1e545528 100644 --- a/src/ffi3/bytearrayobject.rs +++ b/src/ffi3/bytearrayobject.rs @@ -8,12 +8,12 @@ extern "C" { pub static mut PyByteArrayIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyByteArray_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyByteArray_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyByteArray_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyByteArray_Type) as c_int } diff --git a/src/ffi3/bytesobject.rs b/src/ffi3/bytesobject.rs index ca7569d0..4d1469e1 100644 --- a/src/ffi3/bytesobject.rs +++ b/src/ffi3/bytesobject.rs @@ -8,12 +8,12 @@ extern "C" { pub static mut PyBytesIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyBytes_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyBytes_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyBytes_Type) as c_int } diff --git a/src/ffi3/complexobject.rs b/src/ffi3/complexobject.rs index b003e666..8b3ff0f5 100644 --- a/src/ffi3/complexobject.rs +++ b/src/ffi3/complexobject.rs @@ -6,12 +6,12 @@ extern "C" { pub static mut PyComplex_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyComplex_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyComplex_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyComplex_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyComplex_Type) as c_int } diff --git a/src/ffi3/dictobject.rs b/src/ffi3/dictobject.rs index 20d58d1a..dc4c16d8 100644 --- a/src/ffi3/dictobject.rs +++ b/src/ffi3/dictobject.rs @@ -13,32 +13,32 @@ extern "C" { pub static mut PyDictValues_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyDict_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyDict_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyDict_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDictKeys_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyDictKeys_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDictItems_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyDictItems_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDictValues_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyDictValues_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyDictViewSet_Check(op: *mut PyObject) -> c_int { (PyDictKeys_Check(op) != 0 || PyDictItems_Check(op) != 0) as c_int } diff --git a/src/ffi3/floatobject.rs b/src/ffi3/floatobject.rs index 6c3bdb46..f1b5439e 100644 --- a/src/ffi3/floatobject.rs +++ b/src/ffi3/floatobject.rs @@ -6,12 +6,12 @@ extern "C" { pub static mut PyFloat_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyFloat_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyFloat_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyFloat_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyFloat_Type) as c_int } diff --git a/src/ffi3/genobject.rs b/src/ffi3/genobject.rs index e1dad5ae..ff22fea0 100644 --- a/src/ffi3/genobject.rs +++ b/src/ffi3/genobject.rs @@ -23,12 +23,12 @@ extern "C" { pub static mut PyGen_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyGen_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyGen_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyGen_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyGen_Type) as c_int } @@ -44,7 +44,7 @@ extern "C" { pub static mut PyCoro_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCoro_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyCoro_Type) } @@ -54,7 +54,7 @@ extern "C" { pub static mut _PyCoroWrapper_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCoroWrapper_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut _PyCoroWrapper_Type) } @@ -66,13 +66,13 @@ extern "C" { } #[cfg(Py_3_6)] -#[inline(always)] +#[inline] pub unsafe fn PyAsyncGen_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyAsyncGen_Type) } #[cfg(not(Py_3_6))] -#[inline(always)] +#[inline] pub unsafe fn PyAsyncGen_Check(_op: *mut PyObject) -> c_int { 0 } diff --git a/src/ffi3/iterobject.rs b/src/ffi3/iterobject.rs index df110ffe..30bd9038 100644 --- a/src/ffi3/iterobject.rs +++ b/src/ffi3/iterobject.rs @@ -10,12 +10,12 @@ extern "C" { pub fn PyCallIter_New(arg1: *mut PyObject, arg2: *mut PyObject) -> *mut PyObject; } -#[inline(always)] +#[inline] pub unsafe fn PySeqIter_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PySeqIter_Type) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyCallIter_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCallIter_Type) as c_int } diff --git a/src/ffi3/listobject.rs b/src/ffi3/listobject.rs index fa526b8d..63c8efe2 100644 --- a/src/ffi3/listobject.rs +++ b/src/ffi3/listobject.rs @@ -9,12 +9,12 @@ extern "C" { pub static mut PyListRevIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyList_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyList_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyList_Type) as c_int } diff --git a/src/ffi3/longobject.rs b/src/ffi3/longobject.rs index e4e7cb64..49aebc55 100644 --- a/src/ffi3/longobject.rs +++ b/src/ffi3/longobject.rs @@ -12,12 +12,12 @@ extern "C" { pub static mut PyLong_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyLong_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyLong_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyLong_Type) as c_int } diff --git a/src/ffi3/memoryobject.rs b/src/ffi3/memoryobject.rs index 6b839acf..90a7ccec 100644 --- a/src/ffi3/memoryobject.rs +++ b/src/ffi3/memoryobject.rs @@ -7,7 +7,7 @@ extern "C" { pub static mut PyMemoryView_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyMemoryView_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyMemoryView_Type) as c_int } diff --git a/src/ffi3/methodobject.rs b/src/ffi3/methodobject.rs index 33c4b118..b90f5232 100644 --- a/src/ffi3/methodobject.rs +++ b/src/ffi3/methodobject.rs @@ -7,7 +7,7 @@ extern "C" { pub static mut PyCFunction_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyCFunction_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyCFunction_Type) as c_int } @@ -63,7 +63,7 @@ impl Default for PyMethodDef { } } -#[inline(always)] +#[inline] pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject { PyCFunction_NewEx(ml, slf, ptr::null_mut()) } diff --git a/src/ffi3/moduleobject.rs b/src/ffi3/moduleobject.rs index becdb4ec..bd842026 100644 --- a/src/ffi3/moduleobject.rs +++ b/src/ffi3/moduleobject.rs @@ -8,12 +8,12 @@ extern "C" { pub static mut PyModule_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyModule_Check(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut PyModule_Type) } -#[inline(always)] +#[inline] pub unsafe fn PyModule_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyModule_Type) as c_int } diff --git a/src/ffi3/object.rs b/src/ffi3/object.rs index 78f10c66..a8c03487 100644 --- a/src/ffi3/object.rs +++ b/src/ffi3/object.rs @@ -34,7 +34,7 @@ pub struct PyVarObject { pub ob_size: Py_ssize_t, } -#[inline(always)] +#[inline] pub unsafe fn Py_REFCNT(ob: *mut PyObject) -> Py_ssize_t { if ob.is_null() { panic!(); @@ -42,12 +42,12 @@ pub unsafe fn Py_REFCNT(ob: *mut PyObject) -> Py_ssize_t { (*ob).ob_refcnt } -#[inline(always)] +#[inline] pub unsafe fn Py_TYPE(ob: *mut PyObject) -> *mut PyTypeObject { (*ob).ob_type } -#[inline(always)] +#[inline] pub unsafe fn Py_SIZE(ob: *mut PyObject) -> Py_ssize_t { (*(ob as *mut PyVarObject)).ob_size } @@ -616,7 +616,7 @@ extern "C" { pub fn PyType_IsSubtype(a: *mut PyTypeObject, b: *mut PyTypeObject) -> c_int; } -#[inline(always)] +#[inline] pub unsafe fn PyObject_TypeCheck(ob: *mut PyObject, tp: *mut PyTypeObject) -> c_int { (Py_TYPE(ob) == tp || PyType_IsSubtype(Py_TYPE(ob), tp) != 0) as c_int } @@ -633,12 +633,12 @@ extern "C" { pub fn PyType_GetFlags(arg1: *mut PyTypeObject) -> c_ulong; } -#[inline(always)] +#[inline] pub unsafe fn PyType_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyType_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyType_Type) as c_int } @@ -753,19 +753,19 @@ pub const Py_TPFLAGS_DEFAULT: c_ulong = pub const Py_TPFLAGS_HAVE_FINALIZE: c_ulong = 1; -#[inline(always)] +#[inline] #[cfg(Py_LIMITED_API)] pub unsafe fn PyType_HasFeature(t: *mut PyTypeObject, f: c_ulong) -> c_int { ((PyType_GetFlags(t) & f) != 0) as c_int } -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyType_HasFeature(t: *mut PyTypeObject, f: c_ulong) -> c_int { (((*t).tp_flags & f) != 0) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyType_FastSubclass(t: *mut PyTypeObject, f: c_ulong) -> c_int { PyType_HasFeature(t, f) } @@ -776,7 +776,7 @@ extern "C" { } // Reference counting macros. -#[inline(always)] +#[inline] pub unsafe fn Py_INCREF(op: *mut PyObject) { if cfg!(py_sys_config = "Py_REF_DEBUG") { Py_IncRef(op) @@ -785,7 +785,7 @@ pub unsafe fn Py_INCREF(op: *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_DECREF(op: *mut PyObject) { if cfg!(py_sys_config = "Py_REF_DEBUG") { Py_DecRef(op) @@ -797,7 +797,7 @@ pub unsafe fn Py_DECREF(op: *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_CLEAR(op: &mut *mut PyObject) { let tmp = *op; if !tmp.is_null() { @@ -806,14 +806,14 @@ pub unsafe fn Py_CLEAR(op: &mut *mut PyObject) { } } -#[inline(always)] +#[inline] pub unsafe fn Py_XINCREF(op: *mut PyObject) { if !op.is_null() { Py_INCREF(op) } } -#[inline(always)] +#[inline] pub unsafe fn Py_XDECREF(op: *mut PyObject) { if !op.is_null() { Py_DECREF(op) @@ -829,12 +829,12 @@ extern "C" { static mut _Py_NotImplementedStruct: PyObject; } -#[inline(always)] +#[inline] pub unsafe fn Py_None() -> *mut PyObject { &mut _Py_NoneStruct } -#[inline(always)] +#[inline] pub unsafe fn Py_NotImplemented() -> *mut PyObject { &mut _Py_NotImplementedStruct } diff --git a/src/ffi3/objimpl.rs b/src/ffi3/objimpl.rs index 2b50f36e..ba22cc57 100644 --- a/src/ffi3/objimpl.rs +++ b/src/ffi3/objimpl.rs @@ -48,14 +48,14 @@ extern "C" { } /// Test if a type has a GC head -#[inline(always)] +#[inline] #[allow(unused_parens)] pub unsafe fn PyType_IS_GC(t: *mut PyTypeObject) -> c_int { PyType_HasFeature(t, Py_TPFLAGS_HAVE_GC) } /// Test if an object has a GC head -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyObject_IS_GC(o: *mut PyObject) -> c_int { (PyType_IS_GC(Py_TYPE(o)) != 0 && match (*Py_TYPE(o)).tp_is_gc { @@ -80,13 +80,13 @@ extern "C" { } /// Test if a type supports weak references -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyType_SUPPORTS_WEAKREFS(t: *mut PyTypeObject) -> c_int { ((*t).tp_weaklistoffset > 0) as c_int } -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyObject_GET_WEAKREFS_LISTPTR(o: *mut PyObject) -> *mut *mut PyObject { let weaklistoffset = (*Py_TYPE(o)).tp_weaklistoffset as isize; diff --git a/src/ffi3/pystate.rs b/src/ffi3/pystate.rs index c3322728..83357640 100644 --- a/src/ffi3/pystate.rs +++ b/src/ffi3/pystate.rs @@ -58,7 +58,7 @@ extern "C" { pub fn PyGILState_GetThisThreadState() -> *mut PyThreadState; } -#[inline(always)] +#[inline] pub unsafe fn PyThreadState_GET() -> *mut PyThreadState { PyThreadState_Get() } diff --git a/src/ffi3/rangeobject.rs b/src/ffi3/rangeobject.rs index 93388240..bdd8e339 100644 --- a/src/ffi3/rangeobject.rs +++ b/src/ffi3/rangeobject.rs @@ -8,7 +8,7 @@ extern "C" { pub static mut PyLongRangeIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyRange_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyRange_Type) as c_int } diff --git a/src/ffi3/sliceobject.rs b/src/ffi3/sliceobject.rs index cda1b1be..2a973c0f 100644 --- a/src/ffi3/sliceobject.rs +++ b/src/ffi3/sliceobject.rs @@ -7,7 +7,7 @@ extern "C" { static mut _Py_EllipsisObject: PyObject; } -#[inline(always)] +#[inline] pub unsafe fn Py_Ellipsis() -> *mut PyObject { &mut _Py_EllipsisObject } @@ -18,7 +18,7 @@ extern "C" { pub static mut PyEllipsis_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PySlice_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PySlice_Type) as c_int } diff --git a/src/ffi3/traceback.rs b/src/ffi3/traceback.rs index 211fe53a..096e9b1c 100644 --- a/src/ffi3/traceback.rs +++ b/src/ffi3/traceback.rs @@ -8,7 +8,7 @@ extern "C" { pub static mut PyTraceBack_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyTraceBack_Check(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyTraceBack_Type) as c_int } diff --git a/src/ffi3/tupleobject.rs b/src/ffi3/tupleobject.rs index 4751f53d..994f70e5 100644 --- a/src/ffi3/tupleobject.rs +++ b/src/ffi3/tupleobject.rs @@ -15,12 +15,12 @@ extern "C" { pub static mut PyTupleIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyTuple_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyTuple_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyTuple_Type) as c_int } @@ -41,7 +41,7 @@ extern "C" { } // Macro, trading safety for speed -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyTuple_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObject { *(*(op as *mut PyTupleObject)) @@ -50,14 +50,14 @@ pub unsafe fn PyTuple_GET_ITEM(op: *mut PyObject, i: Py_ssize_t) -> *mut PyObjec .offset(i as isize) } -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyTuple_GET_SIZE(op: *mut PyObject) -> Py_ssize_t { Py_SIZE(op) } /// Macro, *only* to be used to fill in brand new tuples -#[inline(always)] +#[inline] #[cfg(not(Py_LIMITED_API))] pub unsafe fn PyTuple_SET_ITEM(op: *mut PyObject, i: Py_ssize_t, v: *mut PyObject) { *(*(op as *mut PyTupleObject)) diff --git a/src/ffi3/unicodeobject.rs b/src/ffi3/unicodeobject.rs index a227eae1..04893b29 100644 --- a/src/ffi3/unicodeobject.rs +++ b/src/ffi3/unicodeobject.rs @@ -16,12 +16,12 @@ extern "C" { pub static mut PyUnicodeIter_Type: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_Check(op: *mut PyObject) -> c_int { PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) } -#[inline(always)] +#[inline] pub unsafe fn PyUnicode_CheckExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut PyUnicode_Type) as c_int } diff --git a/src/ffi3/weakrefobject.rs b/src/ffi3/weakrefobject.rs index 07198d6d..554bc930 100644 --- a/src/ffi3/weakrefobject.rs +++ b/src/ffi3/weakrefobject.rs @@ -10,23 +10,23 @@ extern "C" { static mut _PyWeakref_CallableProxyType: PyTypeObject; } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckRef(op: *mut PyObject) -> c_int { PyObject_TypeCheck(op, &mut _PyWeakref_RefType) } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckRefExact(op: *mut PyObject) -> c_int { (Py_TYPE(op) == &mut _PyWeakref_RefType) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_CheckProxy(op: *mut PyObject) -> c_int { ((Py_TYPE(op) == &mut _PyWeakref_ProxyType) || (Py_TYPE(op) == &mut _PyWeakref_CallableProxyType)) as c_int } -#[inline(always)] +#[inline] pub unsafe fn PyWeakref_Check(op: *mut PyObject) -> c_int { (PyWeakref_CheckRef(op) != 0 || PyWeakref_CheckProxy(op) != 0) as c_int } diff --git a/src/instance.rs b/src/instance.rs index b46458ec..17d27c6a 100644 --- a/src/instance.rs +++ b/src/instance.rs @@ -21,7 +21,7 @@ impl PyToken { PyToken(PhantomData) } - #[inline(always)] + #[inline] pub fn py(&self) -> Python { unsafe { Python::assume_gil_acquired() } diff --git a/src/objects/exc.rs b/src/objects/exc.rs index de8ddda1..866263fd 100644 --- a/src/objects/exc.rs +++ b/src/objects/exc.rs @@ -38,7 +38,7 @@ macro_rules! exc_type( } } impl PyTypeObject for $name { - #[inline(always)] + #[inline] fn init_type() {} #[inline] diff --git a/src/objects/exc_impl.rs b/src/objects/exc_impl.rs index 4846764e..c6eb50bf 100644 --- a/src/objects/exc_impl.rs +++ b/src/objects/exc_impl.rs @@ -69,7 +69,7 @@ macro_rules! import_exception { } impl $crate::typeob::PyTypeObject for $name { - #[inline(always)] + #[inline] fn init_type() {} #[inline] diff --git a/src/objects/mod.rs b/src/objects/mod.rs index 1181c7a6..9e644e00 100644 --- a/src/objects/mod.rs +++ b/src/objects/mod.rs @@ -68,7 +68,7 @@ macro_rules! pyobject_native_type_named( } impl<$($type_param,)*> $crate::PyObjectWithToken for $name { - #[inline(always)] + #[inline] fn py(&self) -> $crate::Python { unsafe { $crate::Python::assume_gil_acquired() } } @@ -129,7 +129,7 @@ macro_rules! pyobject_native_type_convert( } impl<$($type_param,)*> $crate::typeob::PyTypeObject for $name { - #[inline(always)] + #[inline] fn init_type() {} #[inline] diff --git a/src/typeob.rs b/src/typeob.rs index 88a1f1d4..df5fa3c4 100644 --- a/src/typeob.rs +++ b/src/typeob.rs @@ -205,7 +205,7 @@ impl IntoPyPointer for PyRawObject { } impl PyObjectWithToken for PyRawObject { - #[inline(always)] + #[inline] fn py(&self) -> Python { unsafe { Python::assume_gil_acquired() } }