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
Review follow-ups: guard set operators and fix the bytes hint
The Set mixin's __or__/__and__ hand _from_iterable a generator, so the
new __init__ guard never saw a bare-string operand: c.titles |= 'esq'
still silently added 'e', 's', 'q' as titles, while __sub__/__xor__
raised only by accident of constructing from the operand. Route all
four operators (and reflections) through a shared bare-string check.
typeshed declares narrower AbstractSet operands and omits the runtime
ABC's __rsub__, hence the targeted type ignores.
The bytes branch of the error hint was itself a trap: following "wrap
it in a list: [b'dr']" produces a set whose bytes elements never match
parsed str tokens — another silent failure. bytes now get "decode it
first: [b'dr'.decode()]".
Also correct the SetManager class docstring's "Only special
functionality" claim (the guards are user-visible API now) and drop
add()'s false "Can pass a list of strings" (that raises
AttributeError).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/release_log.rst
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
Release Log
2
2
===========
3
3
* 1.3.0 - Unreleased
4
-
- Fix a bare string passed to a set-backed ``Constants`` argument (e.g. ``Constants(titles='dr')``)or to ``SetManager`` being silently split into single characters, replacing the default set and producing wrong parses with no error; it now raises ``TypeError`` with the suggested fix (wrap it in a list) (closes #238)
4
+
- Fix a bare string passed to a set-backed ``Constants`` argument (e.g. ``Constants(titles='dr')``), to ``SetManager``, or as a ``SetManager`` set-operator operand (e.g. ``constants.titles |= 'esq'``) being silently split into single characters, replacing or polluting the set and producing wrong parses with no error; it now raises ``TypeError`` with the suggested fix — wrap strings in a list, decode ``bytes`` first (closes #238)
5
5
- Fix the ``constants`` constructor argument silently discarding ``Constants`` *subclass* instances: the exact-type check replaced them with fresh defaults, throwing away the caller's configuration. Subclass instances are now used as given; anything that is neither ``None`` nor a ``Constants`` instance now raises ``TypeError`` instead of being silently swapped for defaults (closes #226)
6
6
- Fix ``IndexError`` in ``initials()``/``initials_list()`` when a ``*_list`` attribute was assigned directly with an element containing unnormalized whitespace (e.g. ``name.middle_list = ['Q R']``), bypassing the parser's whitespace normalization (closes #232)
7
7
- Fix ``HumanName`` acting as its own iterator with a stored cursor: breaking out of a loop, iterating in nested loops, or calling ``len(name)`` mid-loop corrupted subsequent iteration; ``iter(name)`` now returns a fresh independent iterator each time. ``next(name)`` on the instance itself (undocumented) now raises ``TypeError`` — call ``next(iter(name))`` instead (closes #225)
0 commit comments