Check for duplicated names when setting element names.

PiperOrigin-RevId: 778827590
Change-Id: I77a208c1571cf735cae80840ea830aa347681f71
This commit is contained in:
Alessio Quaglino
2025-07-03 03:19:51 -07:00
committed by Copybara-Service
parent 594e17074a
commit 564c51ddb9
12 changed files with 96 additions and 74 deletions
@@ -677,7 +677,9 @@ def generate_name() -> None:
return mjs_getName(self.element);
}},
[](raw::{titlecase}& self, std::string& name) -> void {{
mjs_setName(self.element, name.c_str());
if (mjs_setName(self.element, name.c_str())) {{
throw pybind11::value_error(mjs_getError(mjs_getSpec(self.element)));
}}
}}, py::return_value_policy::reference_internal);
"""
print(code)