dcavalca / rpms / rpm

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