Bug: scripting API master.italicAngle incorrect until master is viewed in GUI

Open a project with masters that have both italicAngle=0 and italicAngle!=0, then run this in the macro window:

import GlyphsApp
for master in Glyphs.font.masters:
  print(master.name, master.italicAngle)

The expected outcome is for the correct italic angles to be printed, but I see 0.0 for most (!?) masters, until I explicitly view them in the GUI (ie tap each of the master buttons in the app’s toolbar to switch to it.)

Here’s a screen recording:
CleanShot 2022-07-10 at 10.15.36.mp4

Glyphs 3.1 (3133) with Python version set to “3.9.1 (Glyphs)” in settings.

Tangential: there’s a floating point interpretation issue that can be seen in the screen recording.

9.399999618530273

The masters have exactly “9.4” but the actual value in the API ends up being an approximation.

Screen Shot 2022-07-10 at 10.24.49

fontinfo.plist:
Screen Shot 2022-07-10 at 10.24.54

python3’s float constructor correctly interprets a textual rep: (so I suspect Glyphs uses a different, buggy IEEE 754 parses for this)

float("9.4") # => 9.4

I fixed the initial value.

The odd display of the float value can happen. This is how floats work. So for displaying it, you always need to check the significant digits and display accordingly. Internally it is a double with the “correct” value.