More complete Python 3 port for improved C compatibility
This commit is contained in:
parent
7a25815c6f
commit
fc50c28189
45
libkdumpfile-c99.patch
Normal file
45
libkdumpfile-c99.patch
Normal file
@ -0,0 +1,45 @@
|
||||
Python 3 does not have a tp_print member in PyTypeObject
|
||||
|
||||
This avoids an int-conversion compiler error with current compilers:
|
||||
|
||||
./kdumpfile.c:1449:9: error: initialization of 'long int' from 'int (*)(PyObject *, FILE *, int)' {aka 'int (*)(struct _object *, FILE *, int)'} makes integer from pointer without a cast
|
||||
1449 | attr_dir_print, /* tp_print*/
|
||||
| ^~~~~~~~~~~~~~
|
||||
|
||||
In Python 3.11, the field at this position is called
|
||||
tp_vectorcall_offset and has type Py_ssize_t, hence the error.
|
||||
|
||||
Submitted upstream: <https://github.com/ptesarik/libkdumpfile/pull/78>
|
||||
|
||||
diff --git a/python/kdumpfile.c b/python/kdumpfile.c
|
||||
index 7c5917522ef05539..332318e76f317dff 100644
|
||||
--- a/python/kdumpfile.c
|
||||
+++ b/python/kdumpfile.c
|
||||
@@ -1143,7 +1143,6 @@ attr_dir_repr(PyObject *_self)
|
||||
Py_XDECREF(colon);
|
||||
return result;
|
||||
}
|
||||
-#endif
|
||||
|
||||
static int
|
||||
attr_dir_print(PyObject *_self, FILE *fp, int flags)
|
||||
@@ -1214,6 +1213,7 @@ attr_dir_print(PyObject *_self, FILE *fp, int flags)
|
||||
kdump_attr_iter_end(ctx, &iter);
|
||||
return -1;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyObject *
|
||||
attr_iterkey_new(PyObject *_self)
|
||||
@@ -1446,7 +1446,11 @@ static PyTypeObject attr_dir_object_type =
|
||||
sizeof(char), /* tp_itemsize*/
|
||||
/* methods */
|
||||
attr_dir_dealloc, /* tp_dealloc*/
|
||||
+#if PY_MAJOR_VERSION < 3
|
||||
attr_dir_print, /* tp_print*/
|
||||
+#else
|
||||
+ 0,
|
||||
+#endif
|
||||
0, /* tp_getattr*/
|
||||
0, /* tp_setattr*/
|
||||
0, /* tp_compare*/
|
@ -9,6 +9,7 @@ Summary: Kernel coredump file access
|
||||
License: LGPL-3.0-or-later OR GPL-2.0-or-later
|
||||
URL: https://github.com/ptesarik/libkdumpfile
|
||||
Source: %{url}/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: libkdumpfile-c99.patch
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: doxygen
|
||||
|
Loading…
Reference in New Issue
Block a user