From 5121d685744d960b04249409820732d895e52cc1 Mon Sep 17 00:00:00 2001 From: CoderShady Date: Thu, 9 Apr 2026 17:18:02 +0530 Subject: [PATCH] Improve boolean input handling in console.py Refactor boolean input handling to avoid eval and improve type checking. --- utils/console.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/console.py b/utils/console.py index a9abf4b..ec7777d 100644 --- a/utils/console.py +++ b/utils/console.py @@ -102,7 +102,10 @@ def handle_input( user_input = input("").strip() if check_type is not False: try: - isinstance(eval(user_input), check_type) # fixme: remove eval + if check_type is bool and isinstance(user_input, str): + if user_input.lower() in ['true', '1', 't', 'y', 'yes', 'yup']: return True + if user_input.lower() in ['false', '0', 'f', 'n', 'no', 'nope']: return False + raise ValueError return check_type(user_input) except: console.print(