From cf9f36a900dcd615e683bb0e38f8141f7a00913096def8711a63a184efd8a405 Mon Sep 17 00:00:00 2001 From: Alexander Bergmann Date: Wed, 28 Sep 2022 14:16:00 +0000 Subject: [PATCH] Accepting request 1006621 from home:abergmann:branches:network:utilities - Fixed python2 backward compability. add: * net-snmp-5.9.3-fixed-python2-bindings.patch OBS-URL: https://build.opensuse.org/request/show/1006621 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-snmp?expand=0&rev=53 --- net-snmp-5.9.3-fixed-python2-bindings.patch | 20 ++++++++++++++++++++ net-snmp.changes | 7 +++++++ net-snmp.spec | 1 + 3 files changed, 28 insertions(+) create mode 100644 net-snmp-5.9.3-fixed-python2-bindings.patch diff --git a/net-snmp-5.9.3-fixed-python2-bindings.patch b/net-snmp-5.9.3-fixed-python2-bindings.patch new file mode 100644 index 0000000..05d53d2 --- /dev/null +++ b/net-snmp-5.9.3-fixed-python2-bindings.patch @@ -0,0 +1,20 @@ +diff -Nurp net-snmp-5.9.3-orig/python/netsnmp/client_intf.c net-snmp-5.9.3/python/netsnmp/client_intf.c +--- net-snmp-5.9.3-orig/python/netsnmp/client_intf.c 2022-07-13 23:14:14.000000000 +0200 ++++ net-snmp-5.9.3/python/netsnmp/client_intf.c 2022-09-23 16:21:44.040588303 +0200 +@@ -872,9 +872,16 @@ py_netsnmp_attr_string(PyObject *obj, co + if (obj && attr_name && PyObject_HasAttrString(obj, attr_name)) { + PyObject *attr = PyObject_GetAttrString(obj, attr_name); + if (attr) { ++#if PY_MAJOR_VERSION >= 3 + *val = PyUnicode_AsUTF8AndSize(attr, len); + Py_DECREF(attr); + return 0; ++#else ++ int retval; ++ retval = PyBytes_AsStringAndSize(attr, val, len); ++ Py_DECREF(attr); ++ return retval; ++#endif + } + } + diff --git a/net-snmp.changes b/net-snmp.changes index f4b814f..c7f1073 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue Sep 27 14:56:27 UTC 2022 - Alexander Bergmann + +- Fixed python2 backward compability. + add: + * net-snmp-5.9.3-fixed-python2-bindings.patch + ------------------------------------------------------------------- Wed Sep 21 14:44:13 UTC 2022 - Alexander Bergmann diff --git a/net-snmp.spec b/net-snmp.spec index ed806b0..6c8b25b 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -63,6 +63,7 @@ Patch12: net-snmp-5.9.1-harden_snmptrapd.service.patch Patch13: net-snmp-5.9.1-suse-systemd-service-files.patch Patch14: net-snmp-5.9.2-fix-create-v3-user-outfile.patch Patch15: net-snmp-5.9.1-subagent-set-response.patch +Patch16: net-snmp-5.9.3-fixed-python2-bindings.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: autoconf