blob: cc670618a2613a50875d4d2766d67a89c19702e1 (
plain)
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
43
|
From 1ef1ea2f0ba3854309114a2395734c34a1e158d8 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho@tycho.pizza>
Date: Mon, 16 Oct 2023 20:01:52 -0600
Subject: [PATCH] module: reorder cairo script surface initialization
PyType_Ready() expects subclasses to be initialized after base classes.
Since ScriptSurface inherits from Surface, Surface must be initialized
first.
This causes a segfault in pypy3.10, and the fix was suggested here:
https://foss.heptapod.net/pypy/pypy/-/issues/4017#note_332375
This fixes the seg fault for me.
Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
---
cairo/cairomodule.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cairo/cairomodule.c b/cairo/cairomodule.c
index 0026a0e..f27330f 100644
--- a/cairo/cairomodule.c
+++ b/cairo/cairomodule.c
@@ -210,6 +210,9 @@ PYCAIRO_MODINIT_FUNC PyInit__cairo(void)
if (PyType_Ready(&PycairoTextExtents_Type) < 0)
return NULL;
+ if (PyType_Ready(&PycairoSurface_Type) < 0)
+ return NULL;
+
#ifdef CAIRO_HAS_SCRIPT_SURFACE
if (PyType_Ready(&PycairoScriptDevice_Type) < 0)
return NULL;
@@ -223,8 +226,6 @@ PYCAIRO_MODINIT_FUNC PyInit__cairo(void)
if (PyType_Ready(&PycairoScaledFont_Type) < 0)
return NULL;
- if (PyType_Ready(&PycairoSurface_Type) < 0)
- return NULL;
#ifdef CAIRO_HAS_IMAGE_SURFACE
if (PyType_Ready(&PycairoImageSurface_Type) < 0)
return NULL;
|