(&mut self)
| 1941 | /// clears the borrow tag). No-op if already owned. |
| 1942 | #[inline(always)] |
| 1943 | pub fn promote(&mut self) { |
| 1944 | if self.is_borrowed() { |
| 1945 | self.as_object().0.ref_count.inc(); |
| 1946 | // SAFETY: clearing the low bit of a non-null pointer keeps it non-zero |
| 1947 | self.bits = |
| 1948 | unsafe { NonZeroUsize::new_unchecked(self.bits.get() & !STACKREF_BORROW_TAG) }; |
| 1949 | } |
| 1950 | } |
| 1951 | } |
| 1952 | |
| 1953 | impl Drop for PyStackRef { |
nothing calls this directly
no test coverage detected