| 2118 | _CHECK_ATTRIBUTE = False |
| 2119 | |
| 2120 | def __init__(self, constant: _ContantT, **kwargs: Unpack[_BaseFieldKwargs]): |
| 2121 | super().__init__(**kwargs) |
| 2122 | self.constant = constant |
| 2123 | self.load_default = constant |
| 2124 | self.dump_default = constant |
| 2125 | # If allow_none was not explicitly provided and the constant is None, |
| 2126 | # None should be considered valid (mirrors Field.__init__ logic). |
| 2127 | if kwargs.get("allow_none") is None and constant is None: |
| 2128 | self.allow_none = True |
| 2129 | |
| 2130 | def _validate_missing(self, value): |
| 2131 | # Omit check for value is missing_ |