You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assigning hn.C after construction bypasses constants validation and fails far from the cause #239
#226 added validation of the constants argument in HumanName.__init__, but C is a plain attribute, so post-construction assignment bypasses it entirely:
fromnameparserimportHumanNamehn=HumanName('John Doe')
hn.C='garbage'# accepted silentlyhn.full_name='Dr John Smith'# AttributeError: 'str' object has no attribute 'regexes'# — raised deep inside collapse_whitespace, no mention of C
The error surfaces at the wrong layer with no pointer to the actual mistake.
Fix: make C a property whose setter reuses the constructor's check (extract a shared _validate_constants helper) so both assignment paths give the same immediate TypeError.
Related detail once this is fixed at the source: the pickle sentinel in __getstate__/__setstate__ maps C is CONSTANTS to None and any None back to CONSTANTS, so an instance whose C was corrupted to None via this bypass currently round-trips to the shared singleton — silently "healing" the corruption and flipping has_own_config. A dedicated module-level sentinel object instead of None would remove that ambiguity; likely moot if the setter validation lands.
Found by review of PR #237 — pre-existing, unrelated to that change.
Activity
Update release log and AGENTS.md for #241, #239, #242, #244