changeset 48411:5140461ee947 stable

fsmonitor: incorporate fixes for Python 3.10 (issue6612) Differential Revision: https://phab.mercurial-scm.org/D11862
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 06 Dec 2021 11:10:59 +0100
parents e6aecc37bfbf
children 602120a96072
files hgext/fsmonitor/pywatchman/bser.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/fsmonitor/pywatchman/bser.c	Sun Nov 28 11:27:08 2021 +0100
+++ b/hgext/fsmonitor/pywatchman/bser.c	Mon Dec 06 11:10:59 2021 +0100
@@ -28,6 +28,7 @@
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <bytesobject.h>
 #ifdef _MSC_VER
@@ -1052,7 +1053,7 @@
     int64_t* total_len_out) {
   const char* start = NULL;
   const char* data = NULL;
-  int datalen = 0;
+  Py_ssize_t datalen = 0;
   const char* end;
   int64_t expected_len;
   off_t position;
@@ -1101,7 +1102,7 @@
 
 static PyObject* bser_loads(PyObject* self, PyObject* args, PyObject* kw) {
   const char* data = NULL;
-  int datalen = 0;
+  Py_ssize_t datalen = 0;
   const char* start;
   const char* end;
   int64_t expected_len;