Get a reference to the GC state. In threading mode this is a true global (OnceLock). In non-threading mode this is thread-local, because PyRwLock/PyMutex use Cell-based locks that are not Sync.
()
| 861 | /// In non-threading mode this is thread-local, because PyRwLock/PyMutex |
| 862 | /// use Cell-based locks that are not Sync. |
| 863 | pub fn gc_state() -> &'static GcState { |
| 864 | rustpython_common::static_cell! { |
| 865 | static GC_STATE: GcState; |
| 866 | } |
| 867 | GC_STATE.get_or_init(GcState::new) |
| 868 | } |
| 869 | |
| 870 | #[cfg(test)] |
| 871 | mod tests { |
no test coverage detected