Skip to main content

API Reference

When the GIL comes back on

What gilguard raises or warns with, and the report that comes with it.

GILEnabledError

The GIL was enabled on a free-threaded interpreter.

GILReport

Everything gilguard knows about why the GIL is on.

GILGuardWarning

Emitted instead of raising when the action is warn.

Turning the guard on and off

import gilguard calls install() for you. Use these to choose the action in code or to stop guarding.

install()

Start guarding imports.

uninstall()

Stop guarding imports.

Checking the interpreter

Small helpers you can use with or without the guard installed.

is_free_threaded_build()

Check whether this interpreter is a free-threaded build.

gil_enabled()

Check whether the GIL is enabled in this process right now.