All option instances must not share the same color table

This commit is contained in:
Kovid Goyal
2021-07-31 18:44:39 +05:30
parent 6bfb704f6f
commit 0045244295
3 changed files with 15 additions and 2 deletions

View File

@@ -182,6 +182,8 @@ def generate_class(defn: Definition, loc: str) -> Tuple[str, str]:
a(' config_overrides: typing.Tuple[str, ...] = ()')
a('')
a(' def __init__(self, options_dict: typing.Optional[typing.Dict[str, typing.Any]] = None) -> None:')
if defn.has_color_table:
a(' self.color_table = array(self.color_table.typecode, self.color_table)')
a(' if options_dict is not None:')
a(' for key in option_names:')
a(' setattr(self, key, options_dict[key])')