colorLib: must copy p1 when p2 is None

ot.Point is mutable
This commit is contained in:
Cosimo Lupo 2020-03-09 19:18:59 +00:00
parent 5eb11359ea
commit b640897a9a
No known key found for this signature in database
GPG Key ID: 20D4A261E4A0E642

View File

@ -1,7 +1,7 @@
import copy
import enum
from functools import partial
from typing import Dict, List, Optional, Tuple, Union
from fontTools.misc.fixedTools import otRound
from fontTools.ttLib.tables import C_O_L_R_
from fontTools.ttLib.tables import C_P_A_L_
from fontTools.ttLib.tables import _n_a_m_e
@ -390,7 +390,7 @@ def buildLinearGradientPaint(
self.ColorLine = colorLine
if p2 is None:
p2 = p1
p2 = copy.copy(p1)
for i, pt in enumerate((p0, p1, p2)):
setattr(self, f"p{i}", _to_variable_point(pt))