Merge pull request #1367 from PyO3/modern-path
Replace edition2015-style paths
This commit is contained in:
commit
4d242133a6
|
@ -51,7 +51,7 @@ impl<'a> Enum<'a> {
|
|||
for (i, var) in self.variants.iter().enumerate() {
|
||||
let struct_derive = var.build();
|
||||
let ext = quote!(
|
||||
let maybe_ret = || -> ::pyo3::PyResult<Self> {
|
||||
let maybe_ret = || -> pyo3::PyResult<Self> {
|
||||
#struct_derive
|
||||
}();
|
||||
if maybe_ret.is_ok() {
|
||||
|
@ -74,7 +74,7 @@ impl<'a> Enum<'a> {
|
|||
#(#var_extracts)*
|
||||
let type_name = obj.get_type().name()?;
|
||||
let err_msg = format!("'{}' object cannot be converted to '{}'", type_name, #error_names);
|
||||
Err(::pyo3::exceptions::PyTypeError::new_err(err_msg))
|
||||
Err(pyo3::exceptions::PyTypeError::new_err(err_msg))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -255,9 +255,9 @@ impl<'a> Container<'a> {
|
|||
quote!("")
|
||||
};
|
||||
quote!(
|
||||
let s = <::pyo3::types::PyTuple as ::pyo3::conversion::PyTryFrom>::try_from(obj)?;
|
||||
let s = <pyo3::types::PyTuple as pyo3::conversion::PyTryFrom>::try_from(obj)?;
|
||||
if s.len() != #len {
|
||||
return Err(::pyo3::exceptions::PyValueError::new_err(#msg))
|
||||
return Err(pyo3::exceptions::PyValueError::new_err(#msg))
|
||||
}
|
||||
Ok(#self_ty(#fields))
|
||||
)
|
||||
|
@ -512,8 +512,8 @@ pub fn build_derive_from_pyobject(tokens: &DeriveInput) -> Result<TokenStream> {
|
|||
let ident = &tokens.ident;
|
||||
Ok(quote!(
|
||||
#[automatically_derived]
|
||||
impl#trait_generics ::pyo3::FromPyObject<#lt_param> for #ident#generics #where_clause {
|
||||
fn extract(obj: &#lt_param ::pyo3::PyAny) -> ::pyo3::PyResult<Self> {
|
||||
impl#trait_generics pyo3::FromPyObject<#lt_param> for #ident#generics #where_clause {
|
||||
fn extract(obj: &#lt_param pyo3::PyAny) -> pyo3::PyResult<Self> {
|
||||
#derives
|
||||
}
|
||||
}
|
||||
|
|
|
@ -302,7 +302,7 @@ pub(crate) fn impl_wrap_getter(
|
|||
let slf = self_ty.receiver(cls);
|
||||
Ok(quote! {
|
||||
unsafe extern "C" fn __wrap(
|
||||
_slf: *mut pyo3::ffi::PyObject, _: *mut ::std::os::raw::c_void) -> *mut pyo3::ffi::PyObject
|
||||
_slf: *mut pyo3::ffi::PyObject, _: *mut std::os::raw::c_void) -> *mut pyo3::ffi::PyObject
|
||||
{
|
||||
const _LOCATION: &'static str = concat!(stringify!(#cls),".",stringify!(#python_name),"()");
|
||||
pyo3::callback_body_without_convert!(_py, {
|
||||
|
@ -357,7 +357,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) -> pyo3::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!(#python_name),"()");
|
||||
pyo3::callback_body_without_convert!(_py, {
|
||||
|
|
|
@ -20,7 +20,7 @@ extern "C" {
|
|||
#[inline]
|
||||
pub unsafe fn PyEval_CallObject(func: *mut PyObject, arg: *mut PyObject) -> *mut PyObject {
|
||||
#[allow(deprecated)]
|
||||
PyEval_CallObjectWithKeywords(func, arg, ::std::ptr::null_mut())
|
||||
PyEval_CallObjectWithKeywords(func, arg, std::ptr::null_mut())
|
||||
}
|
||||
|
||||
extern "C" {
|
||||
|
|
|
@ -52,10 +52,10 @@ pub struct PyMethodDef {
|
|||
}
|
||||
|
||||
pub const PyMethodDef_INIT: PyMethodDef = PyMethodDef {
|
||||
ml_name: ::std::ptr::null(),
|
||||
ml_name: std::ptr::null(),
|
||||
ml_meth: None,
|
||||
ml_flags: 0,
|
||||
ml_doc: ::std::ptr::null(),
|
||||
ml_doc: std::ptr::null(),
|
||||
};
|
||||
|
||||
impl Default for PyMethodDef {
|
||||
|
|
|
@ -58,7 +58,7 @@ pub const PyModuleDef_HEAD_INIT: PyModuleDef_Base = PyModuleDef_Base {
|
|||
ob_base: PyObject_HEAD_INIT,
|
||||
m_init: None,
|
||||
m_index: 0,
|
||||
m_copy: ::std::ptr::null_mut(),
|
||||
m_copy: std::ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -87,11 +87,11 @@ pub struct PyModuleDef {
|
|||
|
||||
pub const PyModuleDef_INIT: PyModuleDef = PyModuleDef {
|
||||
m_base: PyModuleDef_HEAD_INIT,
|
||||
m_name: ::std::ptr::null(),
|
||||
m_doc: ::std::ptr::null(),
|
||||
m_name: std::ptr::null(),
|
||||
m_doc: std::ptr::null(),
|
||||
m_size: 0,
|
||||
m_methods: ::std::ptr::null_mut(),
|
||||
m_slots: ::std::ptr::null_mut(),
|
||||
m_methods: std::ptr::null_mut(),
|
||||
m_slots: std::ptr::null_mut(),
|
||||
m_traverse: None,
|
||||
m_clear: None,
|
||||
m_free: None,
|
||||
|
|
|
@ -29,27 +29,27 @@ pub struct PyObject {
|
|||
#[cfg(py_sys_config = "Py_TRACE_REFS")]
|
||||
#[cfg(not(PyPy))]
|
||||
pub const PyObject_HEAD_INIT: PyObject = PyObject {
|
||||
_ob_next: ::std::ptr::null_mut(),
|
||||
_ob_prev: ::std::ptr::null_mut(),
|
||||
_ob_next: std::ptr::null_mut(),
|
||||
_ob_prev: std::ptr::null_mut(),
|
||||
ob_refcnt: 1,
|
||||
ob_type: ::std::ptr::null_mut(),
|
||||
ob_type: std::ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[cfg(not(py_sys_config = "Py_TRACE_REFS"))]
|
||||
#[cfg(not(PyPy))]
|
||||
pub const PyObject_HEAD_INIT: PyObject = PyObject {
|
||||
ob_refcnt: 1,
|
||||
ob_type: ::std::ptr::null_mut(),
|
||||
ob_type: std::ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[cfg(py_sys_config = "Py_TRACE_REFS")]
|
||||
#[cfg(PyPy)]
|
||||
pub const PyObject_HEAD_INIT: PyObject = PyObject {
|
||||
_ob_next: ::std::ptr::null_mut(),
|
||||
_ob_prev: ::std::ptr::null_mut(),
|
||||
_ob_next: std::ptr::null_mut(),
|
||||
_ob_prev: std::ptr::null_mut(),
|
||||
ob_refcnt: 1,
|
||||
ob_pypy_link: 0,
|
||||
ob_type: ::std::ptr::null_mut(),
|
||||
ob_type: std::ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[cfg(not(py_sys_config = "Py_TRACE_REFS"))]
|
||||
|
@ -57,7 +57,7 @@ pub const PyObject_HEAD_INIT: PyObject = PyObject {
|
|||
pub const PyObject_HEAD_INIT: PyObject = PyObject {
|
||||
ob_refcnt: 1,
|
||||
ob_pypy_link: 0,
|
||||
ob_type: ::std::ptr::null_mut(),
|
||||
ob_type: std::ptr::null_mut(),
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -413,7 +413,7 @@ mod typeobject {
|
|||
#[cfg(Py_3_8)]
|
||||
pub tp_vectorcall: Option<object::vectorcallfunc>,
|
||||
#[cfg(PyPy)]
|
||||
pub tp_pypy_flags: ::std::os::raw::c_long,
|
||||
pub tp_pypy_flags: std::os::raw::c_long,
|
||||
#[cfg(py_sys_config = "COUNT_ALLOCS")]
|
||||
pub tp_allocs: Py_ssize_t,
|
||||
#[cfg(py_sys_config = "COUNT_ALLOCS")]
|
||||
|
|
|
@ -43,7 +43,7 @@ pub struct PyObjectArenaAllocator {
|
|||
impl Default for PyObjectArenaAllocator {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
unsafe { ::std::mem::zeroed() }
|
||||
unsafe { std::mem::zeroed() }
|
||||
}
|
||||
}
|
||||
#[cfg(not(Py_LIMITED_API))]
|
||||
|
|
|
@ -13,7 +13,7 @@ pub struct PyHash_FuncDef {
|
|||
impl Default for PyHash_FuncDef {
|
||||
#[inline]
|
||||
fn default() -> Self {
|
||||
unsafe { ::std::mem::zeroed() }
|
||||
unsafe { std::mem::zeroed() }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,5 +5,5 @@ pub type Py_ssize_t = ::libc::ssize_t;
|
|||
pub type Py_hash_t = Py_ssize_t;
|
||||
pub type Py_uhash_t = ::libc::size_t;
|
||||
|
||||
pub const PY_SSIZE_T_MIN: Py_ssize_t = ::std::isize::MIN as Py_ssize_t;
|
||||
pub const PY_SSIZE_T_MAX: Py_ssize_t = ::std::isize::MAX as Py_ssize_t;
|
||||
pub const PY_SSIZE_T_MIN: Py_ssize_t = std::isize::MIN as Py_ssize_t;
|
||||
pub const PY_SSIZE_T_MAX: Py_ssize_t = std::isize::MAX as Py_ssize_t;
|
||||
|
|
|
@ -33,20 +33,20 @@ macro_rules! pyobject_native_type_base(
|
|||
($name: ty $(;$generics: ident)* ) => {
|
||||
unsafe impl<$($generics,)*> $crate::PyNativeType for $name {}
|
||||
|
||||
impl<$($generics,)*> ::std::fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter)
|
||||
-> Result<(), ::std::fmt::Error>
|
||||
impl<$($generics,)*> std::fmt::Debug for $name {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter)
|
||||
-> Result<(), std::fmt::Error>
|
||||
{
|
||||
let s = self.repr().map_err(|_| ::std::fmt::Error)?;
|
||||
let s = self.repr().map_err(|_| std::fmt::Error)?;
|
||||
f.write_str(&s.to_string_lossy())
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($generics,)*> ::std::fmt::Display for $name {
|
||||
fn fmt(&self, f: &mut ::std::fmt::Formatter)
|
||||
-> Result<(), ::std::fmt::Error>
|
||||
impl<$($generics,)*> std::fmt::Display for $name {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter)
|
||||
-> Result<(), std::fmt::Error>
|
||||
{
|
||||
let s = self.str().map_err(|_| ::std::fmt::Error)?;
|
||||
let s = self.str().map_err(|_| std::fmt::Error)?;
|
||||
f.write_str(&s.to_string_lossy())
|
||||
}
|
||||
}
|
||||
|
@ -78,14 +78,14 @@ macro_rules! pyobject_native_type_named (
|
|||
($name: ty $(;$generics: ident)*) => {
|
||||
$crate::pyobject_native_type_base!($name $(;$generics)*);
|
||||
|
||||
impl<$($generics,)*> ::std::convert::AsRef<$crate::PyAny> for $name {
|
||||
impl<$($generics,)*> std::convert::AsRef<$crate::PyAny> for $name {
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &$crate::PyAny {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl<$($generics,)*> ::std::ops::Deref for $name {
|
||||
impl<$($generics,)*> std::ops::Deref for $name {
|
||||
type Target = $crate::PyAny;
|
||||
|
||||
#[inline]
|
||||
|
@ -119,7 +119,7 @@ macro_rules! pyobject_native_type_named (
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, $($generics,)*> ::std::convert::From<&'a $name> for &'a $crate::PyAny {
|
||||
impl<'a, $($generics,)*> std::convert::From<&'a $name> for &'a $crate::PyAny {
|
||||
fn from(ob: &'a $name) -> Self {
|
||||
unsafe{&*(ob as *const $name as *const $crate::PyAny)}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue