Skip to content

Commit

Permalink
remove Deref implementations for old "gil refs" types
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Oct 4, 2024
1 parent e9a1b9b commit f8122d4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 18 deletions.
2 changes: 2 additions & 0 deletions src/exceptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ macro_rules! create_exception_type_object {
macro_rules! impl_native_exception (
($name:ident, $exc_name:ident, $doc:expr, $layout:path $(, #checkfunction=$checkfunction:path)?) => (
#[doc = $doc]
#[repr(transparent)]
#[allow(clippy::upper_case_acronyms)]
pub struct $name($crate::PyAny);

Expand All @@ -291,6 +292,7 @@ macro_rules! impl_windows_native_exception (
($name:ident, $exc_name:ident, $doc:expr, $layout:path) => (
#[cfg(windows)]
#[doc = $doc]
#[repr(transparent)]
#[allow(clippy::upper_case_acronyms)]
pub struct $name($crate::PyAny);

Expand Down
4 changes: 2 additions & 2 deletions src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ unsafe impl<T> crate::AsPyPointer for Py<T> {

impl<T> std::convert::From<Py<T>> for PyObject
where
T: AsRef<PyAny>,
T: DerefToPyAny,
{
#[inline]
fn from(other: Py<T>) -> Self {
Expand All @@ -1754,7 +1754,7 @@ where

impl<T> std::convert::From<Bound<'_, T>> for PyObject
where
T: AsRef<PyAny>,
T: DerefToPyAny,
{
#[inline]
fn from(other: Bound<'_, T>) -> Self {
Expand Down
16 changes: 0 additions & 16 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,22 +118,6 @@ pub trait DerefToPyAny {
#[macro_export]
macro_rules! pyobject_native_type_named (
($name:ty $(;$generics:ident)*) => {
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 {
type Target = $crate::PyAny;

#[inline]
fn deref(&self) -> &$crate::PyAny {
&self.0
}
}

impl $crate::types::DerefToPyAny for $name {}
};
);
Expand Down

0 comments on commit f8122d4

Please sign in to comment.