From 4ac6a6bf1558f92719f152b593350218bf9c2761 Mon Sep 17 00:00:00 2001 From: David Hewitt Date: Thu, 21 Dec 2023 15:51:56 +0000 Subject: [PATCH] add safety note to `downcast_into_unchecked` --- src/types/any.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/types/any.rs b/src/types/any.rs index 29babac8..2e8a518f 100644 --- a/src/types/any.rs +++ b/src/types/any.rs @@ -1617,6 +1617,10 @@ pub trait PyAnyMethods<'py> { unsafe fn downcast_unchecked(&self) -> &Bound<'py, T>; /// Like `downcast_unchecked` but takes ownership of `self`. + /// + /// # Safety + /// + /// Callers must ensure that the type is valid or risk type confusion. unsafe fn downcast_into_unchecked(self) -> Bound<'py, T>; /// Extracts some type from the Python object.