!11 fix SystemError:PY_SSIZE_T_CLEAN macro must be defined for '#' formats
From: @tong_1001 Reviewed-by: @openeuler-basic Signed-off-by: @openeuler-basic
This commit is contained in:
commit
00d84c89b0
46
backport-reader-make-PY_SSIZE_T_CLEAN.patch
Normal file
46
backport-reader-make-PY_SSIZE_T_CLEAN.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From ab9f2797127b374665c37c06b02121f5dcf7d61c Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||||
|
Date: Thu, 12 Nov 2020 16:55:56 +0100
|
||||||
|
Subject: [PATCH 2/2] reader: make PY_SSIZE_T_CLEAN
|
||||||
|
|
||||||
|
---
|
||||||
|
systemd/_reader.c | 15 +++++++++++++--
|
||||||
|
1 file changed, 13 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/systemd/_reader.c b/systemd/_reader.c
|
||||||
|
index 8de7f6a963..3b6a4d0bbc 100644
|
||||||
|
--- a/systemd/_reader.c
|
||||||
|
+++ b/systemd/_reader.c
|
||||||
|
@@ -18,7 +18,12 @@
|
||||||
|
along with python-systemd; If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
***/
|
||||||
|
|
||||||
|
+#define PY_SSIZE_T_CLEAN
|
||||||
|
+#pragma GCC diagnostic push
|
||||||
|
+#pragma GCC diagnostic ignored "-Wredundant-decls"
|
||||||
|
#include <Python.h>
|
||||||
|
+#pragma GCC diagnostic pop
|
||||||
|
+
|
||||||
|
#include <structmember.h>
|
||||||
|
#include <datetime.h>
|
||||||
|
#include <time.h>
|
||||||
|
@@ -710,11 +715,17 @@ PyDoc_STRVAR(Reader_add_match__doc__,
|
||||||
|
"Match is a string of the form \"FIELD=value\".");
|
||||||
|
static PyObject* Reader_add_match(Reader *self, PyObject *args, PyObject *keywds) {
|
||||||
|
char *match;
|
||||||
|
- int match_len, r;
|
||||||
|
+ Py_ssize_t match_len;
|
||||||
|
+ int r;
|
||||||
|
if (!PyArg_ParseTuple(args, "s#:add_match", &match, &match_len))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
- r = sd_journal_add_match(self->j, match, match_len);
|
||||||
|
+ if (match_len > INT_MAX) {
|
||||||
|
+ set_error(-ENOBUFS, NULL, NULL);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ r = sd_journal_add_match(self->j, match, (int) match_len);
|
||||||
|
if (set_error(r, NULL, "Invalid match") < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
@ -1,11 +1,13 @@
|
|||||||
Name: python-systemd
|
Name: python-systemd
|
||||||
Version: 234
|
Version: 234
|
||||||
Release: 13
|
Release: 14
|
||||||
Summary: Python module for native access to the systemd facilities.
|
Summary: Python module for native access to the systemd facilities.
|
||||||
License: LGPLv2+
|
License: LGPLv2+
|
||||||
URL: https://github.com/systemd/%{name}
|
URL: https://github.com/systemd/%{name}
|
||||||
Source0: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
Source0: https://github.com/systemd/%{name}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
Patch6000: backport-reader-make-PY_SSIZE_T_CLEAN.patch
|
||||||
|
|
||||||
BuildRequires: gcc systemd-devel
|
BuildRequires: gcc systemd-devel
|
||||||
|
|
||||||
BuildRequires: python3-devel python3-sphinx python3-pytest
|
BuildRequires: python3-devel python3-sphinx python3-pytest
|
||||||
@ -61,6 +63,9 @@ make check PYTHON=%{__python3}
|
|||||||
%exclude %{_pkgdocdir}/html
|
%exclude %{_pkgdocdir}/html
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Feb 26 2022 shixuantong <shixuantong@h-partners.com> - 234-14
|
||||||
|
- fix SystemError:PY_SSIZE_T_CLEAN macro must be defined for '#' formats
|
||||||
|
|
||||||
* Wed Mar 03 2021 shixuantong <shixuantong@huawei.com> - 234-13
|
* Wed Mar 03 2021 shixuantong <shixuantong@huawei.com> - 234-13
|
||||||
- add debuginfo and debugsource
|
- add debuginfo and debugsource
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user