Fix read mode when loading cached AFM fonts #6898

Merged
merged 1 commit into from Aug 4, 2016

Conversation

Projects
None yet
4 participants
Member

zblz commented Aug 3, 2016

This fixes a typo to read cached AFM fonts as a byte string, as needed by the AFM class in afm.py. This bug is triggered when testing PR #5161.

cc: @mdboom

@zblz zblz read cached afm files as bytes
c766846

mdboom added the needs_review label Aug 3, 2016

Member

WeatherGod commented Aug 4, 2016

Indeed, reading through afm.py, it looks like it expects all of the reads to return bytestrings given that it does comparisons against literal byte-strings.

@WeatherGod WeatherGod merged commit f3b6c4e into matplotlib:master Aug 4, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.002%) to 70.838%
Details

mdboom removed the needs_review label Aug 4, 2016

Member

WeatherGod commented Aug 4, 2016

This piqued my interest a bit, and I noticed that we are inconsistent with how we are opening the AFM files. Grepping through reveals a few more non-binary open() calls. Would you like to fix those, too?

Member

WeatherGod commented Aug 4, 2016

actually, looks like that was the only one, although the one in font_manager.py could benefit from context manager. I'll backport just this.

@WeatherGod WeatherGod added a commit that referenced this pull request Aug 4, 2016

@WeatherGod WeatherGod Merge pull request #6898 from zblz/afm-bytes
Fix read mode when loading cached AFM fonts
08e2520
Member

WeatherGod commented Aug 4, 2016

Backported to v2.x via 08e2520.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment