Description: Build a real constant node for None literals
 ex_literal() represented a None literal as ast.Name('None', ast.Load()),
 i.e. a load of a variable that happens to be spelled "None". Since Python
 3.8 the compiler rejects that: None is a keyword constant, not a name, and
 compiling the node raises "ValueError: Name node can't be used with 'None'
 constant". The template compiler hits this whenever a template interpolates
 a missing/None value, which fails the build's test suite.
 .
 Emit ast.Constant(None) instead, which is the node the compiler expects.
 This package builds for Python 3 only (debian/rules uses --with python3),
 so the Python 2 spelling is not a concern.
Author: John Breton <john.breton@canonical.com>
Forwarded: not-needed
Last-Update: 2026-09-08
--- a/beets/util/functemplate.py
+++ b/beets/util/functemplate.py
@@ -74,7 +74,7 @@
     value.
     """
     if val is None:
-        return ast.Name('None', ast.Load())
+        return ast.Constant(None)
     elif isinstance(val, six.integer_types):
         return ast.Num(val)
     elif isinstance(val, bool):
