blob: 3a3e02f35289b3fd42760718df463f3a7886c154 [file] [log] [blame]
Andrew Geissler82c905d2020-04-13 13:39:40 -05001From 66d9b2ba3fbc7b04f2b5ad9d0e5371340c037b5f Mon Sep 17 00:00:00 2001
2From: Marek Blaha <mblaha@redhat.com>
3Date: Wed, 10 Jul 2019 10:11:01 +0200
4Subject: [oe-core][PATCH 1/1] Fix Python 3.8 deprecation warning
5 (RhBug:1724244)
6
7This deprecation warning was introduced in Python 3.8 by
8https://bugs.python.org/issue36381:
9
10/usr/lib/python3.8/site-packages/dnf/package.py:57: DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
11 return super(Package, self).chksum
12
13https://bugzilla.redhat.com/show_bug.cgi?id=1724244
14---
15 python/hawkey/package-py.cpp | 3 ++-
16 python/hawkey/packagedelta-py.cpp | 3 ++-
17 2 files changed, 4 insertions(+), 2 deletions(-)
18---
19
20Unchanged. Appears in version 0.35.2.
21
22Upstream-Status: Backport [git://github.com/rpm-software-management/libdnf.git]
23
24Signed-off-by: Joe Slater <joe.slater@windriver.com>
25
26
27diff --git a/python/hawkey/package-py.cpp b/python/hawkey/package-py.cpp
28index 5102bba..68e03cb 100644
29--- a/python/hawkey/package-py.cpp
30+++ b/python/hawkey/package-py.cpp
31@@ -18,6 +18,7 @@
32 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35+#define PY_SSIZE_T_CLEAN
36 #include <Python.h>
37 #include <stdio.h>
38
39@@ -251,7 +252,7 @@ get_chksum(_PackageObject *self, void *closure)
40 #if PY_MAJOR_VERSION < 3
41 res = Py_BuildValue("is#", type, cs, checksum_length);
42 #else
43- res = Py_BuildValue("iy#", type, cs, checksum_length);
44+ res = Py_BuildValue("iy#", type, cs, (Py_ssize_t)checksum_length);
45 #endif
46
47 return res;
48diff --git a/python/hawkey/packagedelta-py.cpp b/python/hawkey/packagedelta-py.cpp
49index ca1cb7d..1a64836 100644
50--- a/python/hawkey/packagedelta-py.cpp
51+++ b/python/hawkey/packagedelta-py.cpp
52@@ -18,6 +18,7 @@
53 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
54 */
55
56+#define PY_SSIZE_T_CLEAN
57 #include <Python.h>
58
59 // hawkey
60@@ -92,7 +93,7 @@ get_chksum(_PackageDeltaObject *self, void *closure)
61 #if PY_MAJOR_VERSION < 3
62 res = Py_BuildValue("is#", type, cs, checksum_length);
63 #else
64- res = Py_BuildValue("iy#", type, cs, checksum_length);
65+ res = Py_BuildValue("iy#", type, cs, (Py_ssize_t)checksum_length);
66 #endif
67
68 return res;
69--
702.7.4
71