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