From e3464b395eca262fe529465cff1ca5b6655c4ff6 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 26 Feb 2026 12:38:36 +0100 Subject: [PATCH] --recursion-limit option in validate.py --- src/ifcopenshell-python/ifcopenshell/validate.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ifcopenshell-python/ifcopenshell/validate.py b/src/ifcopenshell-python/ifcopenshell/validate.py index 13f148d520..e1270afb57 100644 --- a/src/ifcopenshell-python/ifcopenshell/validate.py +++ b/src/ifcopenshell-python/ifcopenshell/validate.py @@ -793,6 +793,12 @@ if __name__ == "__main__": parser.add_argument("files", nargs="+", help="The IFC file to validate.") parser.add_argument("--rules", action="store_true", help="Run express rules.") parser.add_argument("--json", action="store_true", help="Output in JSON format.") + parser.add_argument( + "--recursion-limit", + type=int, + default=-1, + help="Override sys.getrecursionlimit to process express rules on deeply nested structures (e.g 10000)", + ) parser.add_argument( "--fields", action="store_true", @@ -804,6 +810,9 @@ if __name__ == "__main__": filenames: list[str] = args.files some_file_is_invalid = False + if args.recursion_limit > 0: + sys.setrecursionlimit(args.recursion_limit) + for fn in filenames: handler = None if args.json: