View Issue Details

IDProjectCategoryView StatusLast Update
0015901ScribusPlug-inspublic2019-12-08 21:24
Reportermjg Assigned Tojghali  
PrioritynormalSeverityblockReproducibilityalways
Status closedResolutionfixed 
Product Version1.5.6.svn 
Target VersionFixed in Version1.5.6.svn 
Summary0015901: Fails to build with python 3.8
DescriptionScribus fails to build with python 3.8
Steps To Reproducemake
Additional InformationPatch attached
TagsNo tags attached.
PatchYes

Activities

mjg

2019-11-02 15:06

reporter  

0001-fix-build-with-python-3.8.patch (2,805 bytes)
From 89bb16d41cc64d056e80d393cfd84f79b43eadc2 Mon Sep 17 00:00:00 2001
From: Michael J Gruber <mjg@fedoraproject.org>
Date: Sat, 2 Nov 2019 14:56:20 +0100
Subject: [PATCH] fix build with python 3.8

In Python 3.8, the reserved "tp_print" slot was changed from
a function pointer to a number, `Py_ssize_t tp_vectorcall_offset`.
In C, there is no "nullptr"; either a 0 or NULL casts automatically
to both pointers and numbers.

Use 0 instead of "nullptr" to be source-compatible both with
Python 3.8 and previous versions.

Patch adapted from a similar YafaRay patch:

https://github.com/YafaRay/Core/pull/114/commits/1f567f92dbec6e334fbdd883cce91d502e9c9b4d
---
 scribus/plugins/scriptplugin/objimageexport.cpp | 2 +-
 scribus/plugins/scriptplugin/objpdffile.cpp     | 2 +-
 scribus/plugins/scriptplugin/objprinter.cpp     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/scribus/plugins/scriptplugin/objimageexport.cpp b/scribus/plugins/scriptplugin/objimageexport.cpp
index cfc3c3fa0..64467586d 100644
--- a/scribus/plugins/scriptplugin/objimageexport.cpp
+++ b/scribus/plugins/scriptplugin/objimageexport.cpp
@@ -221,7 +221,7 @@ PyTypeObject ImageExport_Type = {
 	sizeof(ImageExport),   // int tp_basicsize, /* For allocation */
 	0,  // int tp_itemsize; /* For allocation */
 	(destructor) ImageExport_dealloc, //	 destructor tp_dealloc;
-	nullptr, //	 printfunc tp_print;
+	0, //	 printfunc tp_print / tpvectorcall_offset;
 	nullptr, //	 getattrfunc tp_getattr;
 	nullptr, //	 setattrfunc tp_setattr;
 	nullptr, //	 cmpfunc tp_compare;
diff --git a/scribus/plugins/scriptplugin/objpdffile.cpp b/scribus/plugins/scriptplugin/objpdffile.cpp
index 2ae8c9345..637acd86d 100644
--- a/scribus/plugins/scriptplugin/objpdffile.cpp
+++ b/scribus/plugins/scriptplugin/objpdffile.cpp
@@ -1555,7 +1555,7 @@ PyTypeObject PDFfile_Type = {
 	/* Methods to implement standard operations */
 
 	(destructor) PDFfile_dealloc, //     destructor tp_dealloc;
-	nullptr, //     printfunc tp_print;
+	0, //     printfunc tp_print / tpvectorcall_offset;
 	nullptr, //     getattrfunc tp_getattr;
 	nullptr, //     setattrfunc tp_setattr;
 	nullptr, //     cmpfunc tp_compare;
diff --git a/scribus/plugins/scriptplugin/objprinter.cpp b/scribus/plugins/scriptplugin/objprinter.cpp
index 3219f7753..9f2c034b5 100644
--- a/scribus/plugins/scriptplugin/objprinter.cpp
+++ b/scribus/plugins/scriptplugin/objprinter.cpp
@@ -517,7 +517,7 @@ PyTypeObject Printer_Type = {
 	/* Methods to implement standard operations */
 
 	(destructor) Printer_dealloc, //     destructor tp_dealloc;
-	nullptr, //     printfunc tp_print;
+	0, //     printfunc tp_print / tpvectorcall_offset;
 	nullptr, //     getattrfunc tp_getattr;
 	nullptr, //     setattrfunc tp_setattr;
 	nullptr, //     cmpfunc tp_compare;
-- 
2.23.0

jghali

2019-11-03 01:17

administrator   ~0046937

Thanks for the report. I did a few more adjustments to prepare for Python 3.9.

Issue History

Date Modified Username Field Change
2019-11-02 15:06 mjg New Issue
2019-11-02 15:06 mjg File Added: 0001-fix-build-with-python-3.8.patch
2019-11-03 01:17 jghali Assigned To => jghali
2019-11-03 01:17 jghali Status new => resolved
2019-11-03 01:17 jghali Resolution open => fixed
2019-11-03 01:17 jghali Fixed in Version => 1.5.6.svn
2019-11-03 01:17 jghali Note Added: 0046937
2019-12-08 21:24 cbradney Status resolved => closed