From 439d89d6e5d113cd8fe84769ab2bb6663a185f7d Mon Sep 17 00:00:00 2001 From: Ashton Meuser Date: Fri, 30 Jan 2026 21:04:41 -0800 Subject: [PATCH 1/2] Filter conflicting global constants See https://github.com/godotengine/godot/pull/115649 --- binding_generator.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index 1ac1deb40..10be3f494 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -2259,8 +2259,12 @@ def generate_global_constants(api, output_dir): header.append("namespace godot {") header.append("") - if len(api["global_constants"]) > 0: - for constant in api["global_constants"]: + # Remove integer limit global constants that overlap with those defined in cstdint + limit_constants = {"UINT8_MAX", "UINT16_MAX", "UINT32_MAX", "INT8_MIN", "INT8_MAX", "INT16_MIN", "INT16_MAX", "INT32_MIN", "INT32_MAX", "INT64_MIN", "INT64_MAX"} + global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants] + + if len(global_constants) > 0: + for constant in global_constants: header.append(f"const int64_t {escape_identifier(constant['name'])} = {constant['value']};") header.append("") From 496e5a2f71c8d95849f2303aa4ffe59ad04aeb6b Mon Sep 17 00:00:00 2001 From: Ashton Meuser Date: Fri, 30 Jan 2026 21:54:52 -0800 Subject: [PATCH 2/2] Fix ruff format diff --- binding_generator.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/binding_generator.py b/binding_generator.py index 10be3f494..7f15e15b5 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -2260,7 +2260,19 @@ def generate_global_constants(api, output_dir): header.append("") # Remove integer limit global constants that overlap with those defined in cstdint - limit_constants = {"UINT8_MAX", "UINT16_MAX", "UINT32_MAX", "INT8_MIN", "INT8_MAX", "INT16_MIN", "INT16_MAX", "INT32_MIN", "INT32_MAX", "INT64_MIN", "INT64_MAX"} + limit_constants = { + "UINT8_MAX", + "UINT16_MAX", + "UINT32_MAX", + "INT8_MIN", + "INT8_MAX", + "INT16_MIN", + "INT16_MAX", + "INT32_MIN", + "INT32_MAX", + "INT64_MIN", + "INT64_MAX", + } global_constants = [c for c in api["global_constants"] if c["name"] not in limit_constants] if len(global_constants) > 0: