From 593faa04d96de5424c2b5163aeed4f1a562e60fd Mon Sep 17 00:00:00 2001 From: Thomas A Caswell 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 958ca9e675d8..2c7733033f24 100644 --- a/src/_macosx.m +++ b/src/_macosx.m @@ -1,3 +1,4 @@ +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/src/_png.cpp b/src/_png.cpp index e7e2352c88dc..da8f696d7fcc 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 diff --git a/src/_tkagg.cpp b/src/_tkagg.cpp index 9c9623344b84..51e6c4d6d976 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 #include #include diff --git a/src/_ttconv.cpp b/src/_ttconv.cpp index 8639eecfbfee..6a5ceafa0d2e 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 diff --git a/src/file_compat.h b/src/file_compat.h index 397e50cbe84c..4115d23e63f5 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 #include #include "numpy/npy_common.h" diff --git a/src/mplutils.h b/src/mplutils.h index 889570715ba3..925ec32c082f 100644 --- a/src/mplutils.h +++ b/src/mplutils.h @@ -4,6 +4,7 @@ #ifndef MPLUTILS_H #define MPLUTILS_H +#define PY_SSIZE_T_CLEAN #include diff --git a/src/numpy_cpp.h b/src/numpy_cpp.h index 31774f97618d..d2bb119a21f3 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 bb11276ebee1..912c93c8bf12 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 bb445c0794a7..7331e283be50 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 71077a1738ad..4d76867a9b45 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/ndarrayobject.h" #include "libqhull/qhull_a.h"