#19 Account for Python 3.8 deprecations (Add PY_SSIZE_T_CLEAN)
Closed 4 years ago by qulogic. Opened 4 years ago by pviktori.
rpms/ pviktori/python-matplotlib size_t-clean  into  master

@@ -0,0 +1,146 @@ 

+ From 593faa04d96de5424c2b5163aeed4f1a562e60fd Mon Sep 17 00:00:00 2001

+ From: Thomas A Caswell <tcaswell@gmail.com>

+ Date: Mon, 1 Apr 2019 18:38:03 -0400

+ Subject: [PATCH] MNT: account for cpython deprecations

+ 

+ The # variants the PyArg formats will raise deprecation warnings in

+ py38.

+ 

+ https://bugs.python.org/issue8677

+ https://bugs.python.org/issue36381

+ https://github.com/python/cpython/pull/12473

+ https://github.com/python/cpython/commit/d3c72a223a5f771f964fc34557c55eb5bfa0f5a0

+ ---

+  src/_macosx.m         | 1 +

+  src/_png.cpp          | 2 +-

+  src/_tkagg.cpp        | 2 +-

+  src/_ttconv.cpp       | 2 +-

+  src/file_compat.h     | 2 +-

+  src/mplutils.h        | 1 +

+  src/numpy_cpp.h       | 2 +-

+  src/py_adaptors.h     | 2 +-

+  src/py_converters.cpp | 2 +-

+  src/qhull_wrap.c      | 1 +

+  10 files changed, 10 insertions(+), 7 deletions(-)

+ 

+ diff --git a/src/_macosx.m b/src/_macosx.m

+ index 958ca9e675d..2c7733033f2 100644

+ --- a/src/_macosx.m

+ +++ b/src/_macosx.m

+ @@ -1,3 +1,4 @@

+ +#define PY_SSIZE_T_CLEAN

+  #include <Cocoa/Cocoa.h>

+  #include <ApplicationServices/ApplicationServices.h>

+  #include <sys/socket.h>

+ diff --git a/src/_png.cpp b/src/_png.cpp

+ index e7e2352c88d..da8f696d7fc 100644

+ --- a/src/_png.cpp

+ +++ b/src/_png.cpp

+ @@ -9,7 +9,7 @@

+     Undefining _POSIX_C_SOURCE and _XOPEN_SOURCE stops a couple

+     of harmless warnings.

+  */

+ -

+ +#define PY_SSIZE_T_CLEAN

+  

+  extern "C" {

+  #   include <png.h>

+ diff --git a/src/_tkagg.cpp b/src/_tkagg.cpp

+ index 9c9623344b8..51e6c4d6d97 100644

+ --- a/src/_tkagg.cpp

+ +++ b/src/_tkagg.cpp

+ @@ -7,7 +7,7 @@

+   * See LICENSE/LICENSE.PIL for details.

+   *

+   */

+ -

+ +#define PY_SSIZE_T_CLEAN

+  #include <Python.h>

+  #include <cstdlib>

+  #include <cstdio>

+ diff --git a/src/_ttconv.cpp b/src/_ttconv.cpp

+ index 8639eecfbfe..6a5ceafa0d2 100644

+ --- a/src/_ttconv.cpp

+ +++ b/src/_ttconv.cpp

+ @@ -5,7 +5,7 @@

+  

+    Python wrapper for TrueType conversion library in ../ttconv.

+   */

+ -

+ +#define PY_SSIZE_T_CLEAN

+  #include "mplutils.h"

+  

+  #include <Python.h>

+ diff --git a/src/file_compat.h b/src/file_compat.h

+ index 397e50cbe84..4115d23e63f 100644

+ --- a/src/file_compat.h

+ +++ b/src/file_compat.h

+ @@ -1,6 +1,6 @@

+  #ifndef MPL_FILE_COMPAT_H

+  #define MPL_FILE_COMPAT_H

+ -

+ +#define PY_SSIZE_T_CLEAN

+  #include <Python.h>

+  #include <stdio.h>

+  #include "numpy/npy_common.h"

+ diff --git a/src/mplutils.h b/src/mplutils.h

+ index 889570715ba..925ec32c082 100644

+ --- a/src/mplutils.h

+ +++ b/src/mplutils.h

+ @@ -4,6 +4,7 @@

+  #if defined(_MSC_VER) && _MSC_VER <= 1600

+  typedef unsigned __int8   uint8_t;

+  #else

+ +#define PY_SSIZE_T_CLEAN

+  #include <stdint.h>

+  #endif

+  

+ diff --git a/src/numpy_cpp.h b/src/numpy_cpp.h

+ index 31774f97618..d2bb119a21f 100644

+ --- a/src/numpy_cpp.h

+ +++ b/src/numpy_cpp.h

+ @@ -2,7 +2,7 @@

+  

+  #ifndef MPL_NUMPY_CPP_H

+  #define MPL_NUMPY_CPP_H

+ -

+ +#define PY_SSIZE_T_CLEAN

+  /***************************************************************************

+   * This file is based on original work by Mark Wiebe, available at:

+   *

+ diff --git a/src/py_adaptors.h b/src/py_adaptors.h

+ index bb11276ebee..912c93c8bf1 100644

+ --- a/src/py_adaptors.h

+ +++ b/src/py_adaptors.h

+ @@ -2,7 +2,7 @@

+  

+  #ifndef MPL_PY_ADAPTORS_H

+  #define MPL_PY_ADAPTORS_H

+ -

+ +#define PY_SSIZE_T_CLEAN

+  /***************************************************************************

+   * This module contains a number of C++ classes that adapt Python data

+   * structures to C++ and Agg-friendly interfaces.

+ diff --git a/src/py_converters.cpp b/src/py_converters.cpp

+ index bb445c0794a..7331e283be5 100644

+ --- a/src/py_converters.cpp

+ +++ b/src/py_converters.cpp

+ @@ -1,5 +1,5 @@

+  #define NO_IMPORT_ARRAY

+ -

+ +#define PY_SSIZE_T_CLEAN

+  #include "py_converters.h"

+  #include "numpy_cpp.h"

+  

+ diff --git a/src/qhull_wrap.c b/src/qhull_wrap.c

+ index 71077a1738a..4d76867a9b4 100644

+ --- a/src/qhull_wrap.c

+ +++ b/src/qhull_wrap.c

+ @@ -5,6 +5,7 @@

+   * triangulation, construct an instance of the matplotlib.tri.Triangulation

+   * class without specifying a triangles array.

+   */

+ +#define PY_SSIZE_T_CLEAN

+  #include "Python.h"

+  #include "numpy/noprefix.h"

+  #include "libqhull/qhull_a.h"

file modified
+5
@@ -74,6 +74,9 @@ 

  Patch1004:      0003-Increase-some-tolerances-for-non-x86-arches.patch

  # Support pytest 4 (from a3b9ef7c7c8750ff65d9341fb20811b2c4c99a73)

  Patch1005:      0004-Avoid-triggering-deprecation-warnings-with-pytest-3..patch

+ # Account for Python 3.8 deprecations

+ # Backported from upstream: https://github.com/matplotlib/matplotlib/commit/593faa04d96de5424c2b5163aeed4f1a562e60fd

+ Patch1006:      0005-python38-deprecations.patch

  

  BuildRequires:  gcc

  BuildRequires:  gcc-c++
@@ -274,6 +277,8 @@ 

  

  %patch1005 -p1

  

+ %patch1006 -p1

+ 

  # Copy setup.cfg to the builddir

  cp -p %{SOURCE1} setup.cfg

  

This will allow python-matplotlib to build on Python 3.8.
Not sure if you want to apply the patch now or wait for an upstream release.

This backports upstream commit 593faa04d96de5424c2b5163aeed4f1a562e60fd
(The commit did not make it to matplotlib 3.1.0.)

Thanks for the fix. We can keep this open until the Koji rebuild starts.

rebased onto 80e5251eb8a637849ac6655f75ec06dfc4e7b7e3

4 years ago

rebased onto 1675479

4 years ago

That commit is in 3.1.0, and I just updated and started building 3.1.1, so this should not be needed.

Pull-Request has been closed by qulogic

4 years ago