File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 1+ rename ` Python::with_gil_unchecked ` to ` Python::attach_unchecked `
Original file line number Diff line number Diff line change @@ -465,18 +465,32 @@ impl Python<'_> {
465465 crate :: interpreter_lifecycle:: initialize ( ) ;
466466 }
467467
468+ /// See [Python::attach_unchecked]
469+ /// # Safety
470+ ///
471+ /// If [`Python::attach`] would succeed, it is safe to call this function.
472+ #[ inline]
473+ #[ track_caller]
474+ #[ deprecated( note = "use `Python::attach_unchecked` instead" , since = "0.26.0" ) ]
475+ pub unsafe fn with_gil_unchecked < F , R > ( f : F ) -> R
476+ where
477+ F : for < ' py > FnOnce ( Python < ' py > ) -> R ,
478+ {
479+ unsafe { Self :: attach_unchecked ( f) }
480+ }
481+
468482 /// Like [`Python::attach`] except Python interpreter state checking is skipped.
469483 ///
470- /// Normally when the GIL is acquired , PyO3 checks that the Python interpreter is
471- /// in an appropriate state (e.g. it is fully initialized). This function skips
484+ /// Normally when attaching to the Python interpreter , PyO3 checks that it is in
485+ /// an appropriate state (e.g. it is fully initialized). This function skips
472486 /// those checks.
473487 ///
474488 /// # Safety
475489 ///
476490 /// If [`Python::attach`] would succeed, it is safe to call this function.
477491 #[ inline]
478492 #[ track_caller]
479- pub unsafe fn with_gil_unchecked < F , R > ( f : F ) -> R
493+ pub unsafe fn attach_unchecked < F , R > ( f : F ) -> R
480494 where
481495 F : for < ' py > FnOnce ( Python < ' py > ) -> R ,
482496 {
You can’t perform that action at this time.
0 commit comments