install()
Start guarding imports.
Usage
install(action=None)import gilguard calls this for you, so you only need it to choose the action in code, or to start guarding again after uninstall().
Before it starts guarding, it checks the interpreter. On a standard build, or if the GIL is already on, it reports that straight away instead.
Parameters
action: str | None = None-
"raise"to raise GILEnabledError,"warn"to emit GILGuardWarning and keep running, or"off"to do nothing.Nonereads theGILGUARD_ACTIONenvironment variable and falls back to"raise".
Raises
ValueError-
If the action is not one of
raise,warnoroff. GILEnabledError-
If the action is
raiseand the interpreter is a standard build, or the GIL is already enabled.