From b8e4600bb84c94c1efde93c186eba7a2f5305836 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 8 Feb 2021 15:43:39 -0800 Subject: [PATCH] interpreterbase: fix ObjectHolder There are two problems: 1. It doesn't take the generic type as a parameter 2. it sets subpproject to None, but expects to always get a string --- mesonbuild/interpreterbase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index e924e9319..376f8b0f5 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -60,9 +60,9 @@ class InterpreterObject: TV_InterpreterObject = T.TypeVar('TV_InterpreterObject') class ObjectHolder(T.Generic[TV_InterpreterObject]): - def __init__(self, obj: InterpreterObject, subproject: T.Optional[str] = None) -> None: - self.held_object = obj # type: InterpreterObject - self.subproject = subproject # type: str + def __init__(self, obj: TV_InterpreterObject, subproject: str = '') -> None: + self.held_object = obj + self.subproject = subproject def __repr__(self) -> str: return ''.format(self.held_object)