Commit e77182d
Make Metadata class readonly/immutable
Add frozen=True to the Metadata dataclass to make all attributes
readonly after creation. This prevents accidental modification of
metadata that represents the immutable properties of a database file.
Changes:
- Added frozen=True to @DataClass decorator
- Updated HISTORY.rst to document the breaking change
- Noted that C extension Metadata has always been readonly
Benefits:
- Consistent behavior between pure Python and C extension
- Prevents bugs from accidental metadata modification
- Better represents the immutable nature of database metadata
Breaking change: Attempting to modify Metadata attributes after
creation will now raise an AttributeError. This brings the pure
Python implementation into consistency with the C extension, which
has always had readonly attributes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 6c7f4c3 commit e77182d
2 files changed
+9
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
311 | | - | |
| 311 | + | |
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| |||
0 commit comments