Using Inline to [re]define default fields causes "maximum recursion depth exceeded"
Problem
Another semi-silly one. Users can probably guess that this is a bad idea, but I tried it anyway.
This happens after telling import to [R]emove old:
[many more lines like the following]
File "beets\beetsplug\inline.py", line 102, in _dict_for
out = dict(obj)
File "beets\beets\dbcore\db.py", line 237, in __getitem__
return getters[key](self)
File "beets\beetsplug\inline.py", line 120, in _func_func
func.__globals__.update(_dict_for(obj))
File "beets\beetsplug\inline.py", line 102, in _dict_for
out = dict(obj)
File "beets\beets\dbcore\db.py", line 237, in __getitem__
return getters[key](self)
File "beets\beetsplug\inline.py", line 120, in _func_func
func.__globals__.update(_dict_for(obj))
File "beets\beetsplug\inline.py", line 102, in _dict_for
out = dict(obj)
File "beets\beets\dbcore\db.py", line 281, in keys
base_keys = list(self._fields) + list(self._values_flex.keys())
RecursionError: maximum recursion depth exceeded while calling a Python object
Led to this problem:
album_fields:
album: |
return 'asdf'
Setup
- OS: Win10 x64 Powershell
- Python version: 3.6.0
- beets version: 1.4.4+ (git intermediate before 1.4.5)
- Turning off plugins made problem go away (yes/no): probably
When I have beets like this, it lists two "album" fields in beet fields.
Potential fix
Maybe quit beets with an error message about using the same fields as beets defaults?
Thanks! That's a pretty clear problem: to compute the value of album, beets is trying to use the value of album. 🙄 We may even be able to support this by cutting the recursion cycle.
Just stumbled upon this issue after trying the following:
item_fields:
original_year: original_year if original_year > 0 else year
album_fields:
original_year: original_year if original_year > 0 else year
So, the only workaround to fix a missing value is adding a custom field?
Indeed; choosing a new name will work.
Just a heads up, this also affects beet update. Had to disable the inline plugin entirely to get anything to work again.