]> git.pld-linux.org Git - packages/libcomps.git/blame - python-3.8.patch
- up to 0.1.11
[packages/libcomps.git] / python-3.8.patch
CommitLineData
2efce5b5
JR
1From 45d0154a1e0bf167656d1ef4050de782452aad2c Mon Sep 17 00:00:00 2001
2From: Victor Stinner <vstinner@redhat.com>
3Date: Wed, 31 Jul 2019 15:03:36 +0200
4Subject: [PATCH] Fix Python method descriptors for Python 3.8
5
6The Python binding cannot be loaded in Python 3.8: import libcomps
7fails with:
8
9 Traceback (most recent call last):
10 File "src/python/src/python3/libcomps/__init__.py", line 1, in <module>
11 from ._libpycomps import *
12 SystemError: bad call flags
13
14Fedora bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1734777
15
16The problem are the following method descriptors of
17libcomps/src/python/src/pycomps.c:
18
19 {"categories_match", (PyCFunction)PyCOMPS_categories_match, METH_KEYWORDS,
20 PyCOMPS_validate__doc__},
21 {"environments_match", (PyCFunction)PyCOMPS_envs_match, METH_KEYWORDS,
22 PyCOMPS_validate__doc__},
23
24In Python 3.7, import didn't check descriptor flags (METH_KEYWORDS):
25these flags were only checked when the methods were called.
26
27In Python 3.8, the flags are checked at soon as the module is
28imported, which prevents the module to be imported.
29
30This change fix the two method descriptors.
31---
32 libcomps/src/python/src/pycomps.c | 4 ++--
33 1 file changed, 2 insertions(+), 2 deletions(-)
34
35diff --git a/libcomps/src/python/src/pycomps.c b/libcomps/src/python/src/pycomps.c
36index b34685c..293a338 100644
37--- a/libcomps/src/python/src/pycomps.c
38+++ b/libcomps/src/python/src/pycomps.c
39@@ -766,9 +766,9 @@ PyDoc_STRVAR(PyCOMPS_arch_filter__doc__,
40 static PyMethodDef PyCOMPS_methods[] = {
41 {"groups_match", (PyCFunction)PyCOMPS_groups_match, METH_VARARGS | METH_KEYWORDS,
42 PyCOMPS_validate__doc__},
43- {"categories_match", (PyCFunction)PyCOMPS_categories_match, METH_KEYWORDS,
44+ {"categories_match", (PyCFunction)PyCOMPS_categories_match, METH_VARARGS | METH_KEYWORDS,
45 PyCOMPS_validate__doc__},
46- {"environments_match", (PyCFunction)PyCOMPS_envs_match, METH_KEYWORDS,
47+ {"environments_match", (PyCFunction)PyCOMPS_envs_match, METH_VARARGS | METH_KEYWORDS,
48 PyCOMPS_validate__doc__},
49 {"validate", (PyCFunction)PyCOMPS_validate, METH_NOARGS,
50 PyCOMPS_validate__doc__},
This page took 0.100955 seconds and 4 git commands to generate.