Skip to content

Commit

Permalink
Remove OWNED_OBJECTS thread local when GILPool is disabled. (#4193)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamreichold authored May 19, 2024
1 parent ac273a1 commit 674708c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/gil.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::impl_::not_send::{NotSend, NOT_SEND};
use crate::impl_::panic::PanicTrap;
use crate::{ffi, Python};
use std::cell::Cell;
#[cfg(debug_assertions)]
#[cfg(all(feature = "gil-refs", debug_assertions))]
use std::cell::RefCell;
#[cfg(not(debug_assertions))]
#[cfg(all(feature = "gil-refs", not(debug_assertions)))]
use std::cell::UnsafeCell;
use std::{mem, ptr::NonNull, sync};

Expand All @@ -27,9 +27,9 @@ std::thread_local! {
static GIL_COUNT: Cell<isize> = const { Cell::new(0) };

/// Temporarily hold objects that will be released when the GILPool drops.
#[cfg(debug_assertions)]
#[cfg(all(feature = "gil-refs", debug_assertions))]
static OWNED_OBJECTS: RefCell<PyObjVec> = const { RefCell::new(Vec::new()) };
#[cfg(not(debug_assertions))]
#[cfg(all(feature = "gil-refs", not(debug_assertions)))]
static OWNED_OBJECTS: UnsafeCell<PyObjVec> = const { UnsafeCell::new(Vec::new()) };
}

Expand Down

0 comments on commit 674708c

Please sign in to comment.