1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
From a2445df58a712980ccd0c21d75a631c6bda89b2b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@debian.org>
Date: Wed, 23 Oct 2024 12:01:24 +0100
Subject: [PATCH] async: Use correct T_BOOL type for _asyncio_future_blocking
Declaring a PyMemberDef with type T_BOOL requires the corresponding C
type to be char, with value 0 or 1: when the member is read, CPython
will effectively be dereferencing
`* (char *) &pygiasync._asyncio_future_blocking`.
On little-endian architectures, in practice this worked, because the
low-order bits of an int are in the first byte, which would take value
0 or 1 as desired, with all other bits zero. However, on big-endian
architectures, the low-order bits of an int are in the last byte, so
reading the _asyncio_future_blocking attribute from Python code would
in practice always produce 0, even when the int field had been set to 1
from C code.
Reference: https://docs.python.org/3/c-api/structures.html#member-types
Resolves: https://gitlab.gnome.org/GNOME/pygobject/-/issues/650
Bug-Debian: https://bugs.debian.org/1085891
Signed-off-by: Simon McVittie <smcv@debian.org>
---
gi/pygi-async.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gi/pygi-async.h b/gi/pygi-async.h
index d5e7a92a7..341d62377 100644
--- a/gi/pygi-async.h
+++ b/gi/pygi-async.h
@@ -37,7 +37,7 @@ typedef struct {
PyGICallableInfo *finish_func;
PyObject *loop;
PyObject *cancellable;
- int _asyncio_future_blocking;
+ char _asyncio_future_blocking;
PyObject *result;
PyObject *exception;
--
GitLab
|