Commit 4338b06
committed
The PR #577 used hasattr(o, i) to skip uninitialized slots, but hasattr() swallows all
AttributeErrors — including those from __getattr__. This made objects with a broken __getattr__
(like the Bad test class) appear to have zero accessible slots rather than failing the strategy.
The fix uses object.__getattribute__() to check each slot directly, which bypasses __getattr__
entirely. For classes that do define __getattr__, if a slot isn't initialized via the descriptor,
we fall back to the normal getattr() — letting __getattr__ either provide a value or raise
(propagating the failure). This correctly handles:
- Uninitialized slots (no __getattr__): skipped gracefully, empty dict is valid
- Partially initialized slots: only initialized ones included
- Broken __getattr__: error propagates, object becomes unprocessed1 parent f0b39cb commit 4338b06
1 file changed
+22
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
280 | 280 | | |
281 | 281 | | |
282 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
283 | 304 | | |
284 | 305 | | |
285 | 306 | | |
| |||
415 | 436 | | |
416 | 437 | | |
417 | 438 | | |
418 | | - | |
| 439 | + | |
419 | 440 | | |
420 | 441 | | |
421 | 442 | | |
| |||
0 commit comments