You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/net-irc/znc/files/znc-1.8.2-fix-python-3.10.p...

32 lines
997 B

From e8ff16123582eb9d5c321f5c7e652335abfba368 Mon Sep 17 00:00:00 2001
From: Alexey Sokolov <alexey+znc@asokolov.org>
Date: Sat, 23 May 2020 13:28:13 +0100
Subject: [PATCH] Fix PY_SSIZE_T_CLEAN python warning
---
.travis.yml | 2 +-
modules/modpython.cpp | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/modules/modpython.cpp b/modules/modpython.cpp
index dfe53b5b6b..7bc76fc5c1 100644
--- a/modules/modpython.cpp
+++ b/modules/modpython.cpp
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <znc/Chan.h>
@@ -455,7 +456,7 @@ CBSOCK(ConnectionRefused);
void CPySocket::ReadData(const char* data, size_t len) {
PyObject* pyRes =
PyObject_CallMethod(m_pyObj, const_cast<char*>("OnReadData"),
- const_cast<char*>("y#"), data, (int)len);
+ const_cast<char*>("y#"), data, (Py_ssize_t)len);
CHECKCLEARSOCK("OnReadData");
}