Skip to content

Commit 96c19f3

Browse files
committed
Temporarily circumvent get-help error to prevent 3.14 tests from catastrophically failing
1 parent 7cc74c9 commit 96c19f3

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

hydra/_internal/utils.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -544,12 +544,28 @@ class LazyCompletionHelp:
544544
def __repr__(self) -> str:
545545
return f"Install or Uninstall shell completion:\n{_get_completion_help()}"
546546

547-
parser.add_argument(
548-
"--shell-completion",
549-
"-sc",
550-
action="store_true",
551-
help=LazyCompletionHelp(), # type: ignore
552-
)
547+
if sys.version_info >= (3, 14):
548+
original_check_help = argparse.ArgumentParser._check_help # type: ignore
549+
argparse.ArgumentParser._check_help = ( # type: ignore
550+
lambda self, action: None
551+
)
552+
try:
553+
parser.add_argument(
554+
"--shell-completion",
555+
"-sc",
556+
action="store_true",
557+
help=LazyCompletionHelp(), # type: ignore
558+
)
559+
finally:
560+
# Immediately restore normal validation
561+
argparse.ArgumentParser._check_help = original_check_help # type: ignore
562+
else:
563+
parser.add_argument(
564+
"--shell-completion",
565+
"-sc",
566+
action="store_true",
567+
help=LazyCompletionHelp(), # type: ignore
568+
)
553569

554570
parser.add_argument(
555571
"--config-path",

0 commit comments

Comments
 (0)