From ec2fb52be3c687df1ea302f2015dd1577cb274d0 Mon Sep 17 00:00:00 2001 From: Eric Jeschke Date: Fri, 17 Jun 2022 14:07:14 -1000 Subject: [PATCH] Fix "PY_SSIZE_T_CLEAN macro must be defined for '#' formats" error - error due to change in Python 3.10 C API --- aggdraw.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/aggdraw.cxx b/aggdraw.cxx index 4d43592..ed13af6 100644 --- a/aggdraw.cxx +++ b/aggdraw.cxx @@ -58,6 +58,8 @@ #define M_PI 3.1415926535897931 #endif +#define PY_SSIZE_T_CLEAN 1 + #include "Python.h" #if PY_MAJOR_VERSION >= 3 #define IS_PY3K @@ -1564,7 +1566,8 @@ const char *draw_frombytes_doc = "Copies data from a string buffer to the drawin static PyObject* draw_frombytes(DrawObject* self, PyObject* args) { - char* data = NULL; int data_size; + char* data = NULL; + Py_ssize_t data_size; if (!PyArg_ParseTuple(args, "s#:frombytes", &data, &data_size)) return NULL;