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
pull/8418/head
Dylan Baker 4 years ago committed by Jussi Pakkanen
parent cef5cab23c
commit b8e4600bb8
  1. 6
      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 '<Holder: {!r}>'.format(self.held_object)

Loading…
Cancel
Save