5bda13
From 2c9d1b3e725ad2a072e9fef4cb1cb0bb9ae2d540 Mon Sep 17 00:00:00 2001
5bda13
From: Graham Dumpleton <Graham.Dumpleton@gmail.com>
5bda13
Date: Sat, 13 Feb 2021 11:05:39 +1100
5bda13
Subject: [PATCH] Fix deprecation warning in PyArg_ParseTuple().
5bda13
5bda13
---
5bda13
 docs/release-notes/version-4.8.0.rst | 5 +++++
5bda13
 src/server/wsgi_logger.c             | 4 ++--
5bda13
 src/server/wsgi_python.h             | 2 ++
5bda13
 3 files changed, 9 insertions(+), 2 deletions(-)
5bda13
5bda13
diff --git a/src/server/wsgi_logger.c b/src/server/wsgi_logger.c
5bda13
index 71c7d69e..df35887e 100644
5bda13
--- a/src/server/wsgi_logger.c
5bda13
+++ b/src/server/wsgi_logger.c
5bda13
@@ -223,7 +223,7 @@ static PyObject *Log_isatty(LogObject *self, PyObject *args)
5bda13
     return Py_False;
5bda13
 }
5bda13
 
5bda13
-static void Log_queue(LogObject *self, const char *msg, int len)
5bda13
+static void Log_queue(LogObject *self, const char *msg, Py_ssize_t len)
5bda13
 {
5bda13
     const char *p = NULL;
5bda13
     const char *q = NULL;
5bda13
@@ -330,7 +330,7 @@ static void Log_queue(LogObject *self, const char *msg, int len)
5bda13
 static PyObject *Log_write(LogObject *self, PyObject *args)
5bda13
 {
5bda13
     const char *msg = NULL;
5bda13
-    int len = -1;
5bda13
+    Py_ssize_t len = -1;
5bda13
 
5bda13
     WSGIThreadInfo *thread_info = NULL;
5bda13
 
5bda13
diff --git a/src/server/wsgi_python.h b/src/server/wsgi_python.h
5bda13
index 0464fe6d..5c10cae5 100644
5bda13
--- a/src/server/wsgi_python.h
5bda13
+++ b/src/server/wsgi_python.h
5bda13
@@ -21,6 +21,8 @@
5bda13
 
5bda13
 /* ------------------------------------------------------------------------- */
5bda13
 
5bda13
+#define PY_SSIZE_T_CLEAN 1
5bda13
+
5bda13
 #include <Python.h>
5bda13
 
5bda13
 #if !defined(PY_VERSION_HEX)