Skip to content

Commit 2d0b19e

Browse files
fix: Preserve Pydantic validation in Config.__setattr__
Changed from object.__setattr__() to super().__setattr__() so that Pydantic's validate_assignment=True works correctly. This fixes: - test_loglevel_validation - now correctly rejects invalid loglevels - test_fetch_format_validation - now correctly rejects invalid formats - test_cache_path_string - now correctly coerces strings to Path Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 933c9fb commit 2d0b19e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/datajoint/settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,8 @@ def __setattr__(self, name: str, value: Any) -> None:
957957
except AttributeError:
958958
pass # thread_safe not set yet (during __init__)
959959

960-
return object.__setattr__(self, name, value)
960+
# Use super().__setattr__ to preserve Pydantic validation
961+
return super().__setattr__(name, value)
961962

962963
# Dict-like access for convenience
963964
def __getitem__(self, key: str) -> Any:

0 commit comments

Comments
 (0)