nightly-c9df7a94-ls288
Pre-releaseCI Report:
https://ci-tests.linuxserver.io/linuxserver/beets/nightly-c9df7a94-ls288/index.html
LinuxServer Changes:
No changes
Remote Changes:
fix(hooks): chain original error when cached_property AttrDict lookup fails (#6558) (#6564)
Fixes #6558.
Problem
When a cached_property on an AttrDict subclass raises
AttributeError during its own computation, Python's attribute lookup
falls back to __getattr__ with the property's own name. That masks the
real missing field behind a misleading traceback like:
AttributeError: 'AlbumInfo' object has no attribute 'raw_data'
…even though raw_data exists on the instance and the code inside
raw_data is what blew up on a missing sibling attribute. Users and
maintainers hit this both on #6558 and on the earlier #6503 / #6506
reports (different metadata providers, same masking shape).
Fix
In AttrDict.__getattr__, if the looked-up class attribute is a
cached_property, invoke it explicitly. If it raises AttributeError,
re-raise as RuntimeError with from exc so the original cause is
preserved on the traceback and names the attribute that actually failed.
Plain missing-attribute behaviour (obj.nope on an AttrDict) is
unchanged — that still raises AttributeError as before.
Tests
Added a regression class TestAttrDictCachedPropertyMasking in
test/autotag/test_hooks.py covering:
- real missing attr in a
cached_propertybody surfaces as
RuntimeErrornaming the missing field - the
RuntimeError.__cause__is the originalAttributeError - a plain missing attr on an
AttrDictstill raisesAttributeError - existing dict-key access (
obj.title) still works
Full test/autotag/test_hooks.py suite: 90 passed locally.
Follow-up
Picked approach (1) from @snejus' comment on #6558
(beetbox/beets#6558 (comment)).
Happy to iterate on the exception type or wording.