prevent possible errors initializing swig wrapper's Settings #4861

This commit is contained in:
Andrej730
2024-06-13 18:19:12 +05:00
parent 9d7ef6ff47
commit 99338187de
@@ -169,6 +169,12 @@ class settings_mixin:
return super().setting_names() + ("use-python-opencascade",)
def __getattr__(self, k: str) -> SETTING:
# Swig wrapper will try to access "this",
# ensure we won't accidentally call any c-extension methods
# like .setting_names() until wrapper is not completely initialized.
# See #4861.
if k == "this":
raise AttributeError("Swig wrapper's 'this' is unset.")
if k in map(self.rname, self.setting_names()):
return k
else: