Commit 305ab0d
fix: stop RegexTupleManager answering dunder probes with a regex
RegexTupleManager.__getattr__ returned the EMPTY_REGEX default for *any*
unknown attribute, including the dunder names Python's machinery probes
for. copy.deepcopy does getattr(obj, "__deepcopy__", None) to detect a
custom deep-copy hook; it received EMPTY_REGEX (a truthy re.Pattern)
instead of None, then tried to call it -> "re.Pattern object is not
callable". The same trap applied to copy.copy, inspect.unwrap, etc.
Reject dunder-shaped names with AttributeError so those probes see the
attribute as absent. Non-dunder unknown keys still get the EMPTY_REGEX
default, preserving existing behavior.
With deepcopy now working for the config managers, drop the
_clone_config_collection workaround in the test conftest (and its
now-stale comment) in favor of copy.deepcopy.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8fb251c commit 305ab0d
3 files changed
Lines changed: 41 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
150 | 157 | | |
151 | 158 | | |
152 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
5 | | - | |
6 | | - | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
38 | 37 | | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | 40 | | |
56 | 41 | | |
57 | 42 | | |
| |||
66 | 51 | | |
67 | 52 | | |
68 | 53 | | |
69 | | - | |
| 54 | + | |
70 | 55 | | |
71 | 56 | | |
72 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
159 | 160 | | |
160 | 161 | | |
161 | 162 | | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
162 | 193 | | |
163 | 194 | | |
164 | 195 | | |
| |||
0 commit comments