5523e9
From f0a58d1dced6215b7caaa70db17d54834e0cd44e Mon Sep 17 00:00:00 2001
5523e9
From: Lubos Kardos <lkardos@redhat.com>
5523e9
Date: Fri, 18 Sep 2015 15:29:25 +0200
5523e9
Subject: [PATCH] Define PY_SSIZE_T_CLEAN
5523e9
5523e9
When PyArg_ParseTupleAndKeywords() is used with format argument "s#"
5523e9
that means get a string and his length then the length is returned as
5523e9
as a Py_ssize_t in python3 but as an int in python2, which casues
5523e9
a problem because rpmfd_write() that uses PyArg_ParseTupleAndKeywords()
5523e9
expects the length as a Py_ssize_t always. This problem affects big
5523e9
endian systems with python2 as default. If PY_SSIZE_T_CLEAN is defined
5523e9
then PyArg_ParseTupleAndKeywords() returns the length as a Py_ssize_t
5523e9
in both python2 and python3.
5523e9
---
5523e9
 python/rpmsystem-py.h | 1 +
5523e9
 1 file changed, 1 insertion(+)
5523e9
5523e9
diff --git a/python/rpmsystem-py.h b/python/rpmsystem-py.h
5523e9
index 50e8770..c8423e3 100644
5523e9
--- a/python/rpmsystem-py.h
5523e9
+++ b/python/rpmsystem-py.h
5523e9
@@ -5,6 +5,7 @@
5523e9
 #include <sys/types.h>
5523e9
 #endif
5523e9
 
5523e9
+#define PY_SSIZE_T_CLEAN
5523e9
 #include <Python.h>
5523e9
 #include <structmember.h>
5523e9
 
5523e9
-- 
5523e9
1.9.3
5523e9