beetbox / beetbox/beets

Using Inline to [re]define default fields causes "maximum recursion depth exceeded"

Open
#2,612 4 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
15.7k
Forks
2.1k
Avg merge
4d 21h
Merged PRs (30d)
31

Description

### 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:

```sh
[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?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.