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
The four cached-union attributes (titles, prefixes, suffix_acronyms, suffix_not_acronyms) are guarded by _CachedUnionMember.__set__, which rejects non-SetManager assignment with a clear TypeError. The other five set-backed attributes — first_name_titles, conjunctions, bound_first_names, non_first_name_prefixes, suffix_acronyms_ambiguous — are plain instance attributes (config/init.py, assigned in Constants.__init__), so this is accepted silently:
fromnameparserimportHumanNamefromnameparser.configimportConstantsc=Constants()
c.conjunctions='and'# attribute is now a plain strHumanName('John An Smith', constants=c)
# first='John An Smith', middle='', last='' (default: John / An / Smith)
Root cause: membership checks like piece.lower() in self.C.conjunctions become substring tests on a str ('an' in 'and' is True), so parsing silently degrades with no traceback pointing at the bad assignment.
The constructor path is guarded since #238 (Constants(conjunctions='and') raises). This is the residual assignment gap. Distinct from #239, which is about hn.C assignment on HumanName, not attribute assignment on Constants.
Fix: guard these five like the cached-union four — a lighter shared descriptor enforcing isinstance(value, SetManager) (without the _pst invalidation), reusing the existing error-message style.
Found by review of PR #240 — pre-existing, unrelated to that change.
Activity
Update release log and AGENTS.md for #241, #239, #242, #244
Restore v1.3/1.4 manager hardening in the shim (#221/#238/#241/#242/#260
Reconcile test_constants against the shim (buckets A, B, C)