Skip to content
Browse files

inline: Fix a ridiculously subtle flexattr bug

As detailed here:
#2406 (comment)

In a *function-style* definition, we didn't properly *un-define* the
values for a given item after each function invocation. So when a field
wasn't defined, it would get the value for the previously-formatted
object instead. It now properly throws a NameError.
  • Loading branch information...
sampsyo committed Jun 1, 2019
1 parent cd66c5d commit 81b1faa053867be53f9b3f72fbc148d11ca67b07
Showing with 13 additions and 0 deletions.
  1. +4 −0 beetsplug/
  2. +9 −0 docs/changelog.rst
@@ -117,9 +117,13 @@ def _expr_func(obj):
# For function bodies, invoke the function with values as global
# variables.
def _func_func(obj):
old_globals = dict(func.__globals__)
return func()
except Exception as exc:
raise InlineError(python_code, exc)
return _func_func
@@ -12,6 +12,15 @@ New features:
Thanks to :user:`dosoe`.
:bug:`2580` :bug:`3272`


* :doc:`/plugins/inline`: In function-style field definitions that refer to
flexible attributes, values could stick around from one function invocation
to the next. This meant that, when displaying a list of objects, later
objects could seem to reuse values from earlier objects when they were
missing a value for a given field. These values are now properly undefined.

For plugin developers:

* `MediaFile`_ has been split into a standalone project. Where you used to do

0 comments on commit 81b1faa

Please sign in to comment.
You can’t perform that action at this time.