Fix int type conversion error that broke text rendering on ppc64
This commit is contained in:
parent
08fc8aa374
commit
cf0338c697
37
7768.patch
Normal file
37
7768.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From c4c0b657ca7b55b99d87b045852227523a293848 Mon Sep 17 00:00:00 2001
|
||||
From: Adam Williamson <awilliam@redhat.com>
|
||||
Date: Sun, 8 Jan 2017 17:12:59 -0800
|
||||
Subject: [PATCH] Convert unicode index to long, not int, in get_char_index
|
||||
|
||||
There's an error in the `PyFT2Font.get_char_index()` method
|
||||
added in 2d56ffeb . The type for the unicode index to be sent
|
||||
to `FT_Get_Char_Index` is `FT_ULong` - an unsigned long - but
|
||||
the `PyArg_ParseTuple` call that converts it from Python used
|
||||
`I` in the format string, which converts a Python int to a C
|
||||
unsigned int, not a C unsigned long. This doesn't seem to cause
|
||||
a problem on little-endian arches, but it results in completely
|
||||
incorrect conversion on big-endian arches, which in turn would
|
||||
result in wrong glyphs, unfound glyphs, and even in an infinite
|
||||
recursion in `UnicodeFonts._get_glyph`.
|
||||
|
||||
To get correct conversion we must use `k` not `I`, which is
|
||||
the specifier for a C unsigned long.
|
||||
|
||||
Ref: https://docs.python.org/3/c-api/arg.html#numbers
|
||||
---
|
||||
src/ft2font_wrapper.cpp | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ft2font_wrapper.cpp b/src/ft2font_wrapper.cpp
|
||||
index a97de68..c77dd83 100644
|
||||
--- a/src/ft2font_wrapper.cpp
|
||||
+++ b/src/ft2font_wrapper.cpp
|
||||
@@ -971,7 +971,7 @@ static PyObject *PyFT2Font_get_char_index(PyFT2Font *self, PyObject *args, PyObj
|
||||
FT_UInt index;
|
||||
FT_ULong ccode;
|
||||
|
||||
- if (!PyArg_ParseTuple(args, "I:get_char_index", &ccode)) {
|
||||
+ if (!PyArg_ParseTuple(args, "k:get_char_index", &ccode)) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
|
||||
Name: python-matplotlib
|
||||
Version: 2.0.0
|
||||
Release: 0.4%{?rctag:.%{rctag}}%{?dist}
|
||||
Release: 0.5%{?rctag:.%{rctag}}%{?dist}
|
||||
Summary: Python 2D plotting library
|
||||
Group: Development/Libraries
|
||||
# qt4_editor backend is MIT
|
||||
@ -72,6 +72,7 @@ Patch9: python-matplotlib-qhull.patch
|
||||
Patch10: python-matplotlib-increase-tests-tolerance.patch
|
||||
Patch11: python-matplotlib-increase-tests-tolerance-aarch64.patch
|
||||
Patch13: python-matplotlib-increase-tests-tolerance-i686.patch
|
||||
Patch14: https://github.com/matplotlib/matplotlib/pull/7768.patch
|
||||
|
||||
BuildRequires: freetype-devel
|
||||
BuildRequires: libpng-devel
|
||||
@ -418,6 +419,7 @@ sed -i 's/\(USE_FONTCONFIG = \)False/\1True/' lib/matplotlib/font_manager.py
|
||||
%ifarch i686
|
||||
%patch13 -p1 -b .tests-i686
|
||||
%endif
|
||||
%patch14 -p1 -b .inttype
|
||||
|
||||
chmod -x lib/matplotlib/mpl-data/images/*.svg
|
||||
chmod -x lib/matplotlib/{dates,sankey}.py
|
||||
@ -616,6 +618,9 @@ PYTHONPATH=%{buildroot}%{python3_sitearch} \
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Sun Jan 08 2017 Adam Williamson <awilliam@redhat.com> - 2.0.0-0.5.b4
|
||||
- Fix int type conversion error that broke text rendering on ppc64 (#1411070)
|
||||
|
||||
* Tue Dec 13 2016 Charalampos Stratakis <cstratak@redhat.com> - 2.0.0-0.4.b4
|
||||
- Rebuild for Python 3.6
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user