Skip to content

Commit 1d24014

Browse files
committed
HooksMixin(fix[set_hook]): Add deprecation warning for g parameter
why: The g parameter was silently ignored in set_hook(), breaking backward compatibility. Code calling set_hook(..., g=True) would not get global behavior. what: - Add DeprecationWarning when g parameter is used - Forward g value to global_ for backward compatibility - Matches pattern used in OptionsMixin.set_option()
1 parent 9595b49 commit 1d24014

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libtmux/hooks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ def set_hook(
136136
if scope is DEFAULT_OPTION_SCOPE:
137137
scope = self.default_hook_scope
138138

139+
if g:
140+
warnings.warn(
141+
"g argument is deprecated in favor of global_",
142+
category=DeprecationWarning,
143+
stacklevel=2,
144+
)
145+
global_ = g
146+
139147
flags: list[str] = []
140148

141149
if unset is not None and unset:

0 commit comments

Comments
 (0)