Work around a Jython bug:

>>> import array; array.array("f", array.array("b", [1,2,3]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: can only extend with array of same kind

>>> import array; array.array("f", list(array.array("b", [1,2,3])))
array('f', [1.0, 2.0, 3.0])
This commit is contained in:
Behdad Esfahbod 2015-03-17 15:32:57 -07:00
parent b9ac90a8f9
commit c511745b2e

View File

@ -1016,7 +1016,8 @@ class GlyphCoordinates(object):
def _ensureFloat(self):
if self.isFloat():
return
self._a = array.array("f", self._a)
# The conversion to list() is to work around Jython bug
self._a = array.array("f", list(self._a))
def _checkFloat(self, p):
if any(isinstance(v, float) for v in p):