Skip to content

Commit

Permalink
Trac #30225: Fix deprecation warnings when unpickling pynac objects w…
Browse files Browse the repository at this point in the history
…ith Python 3.8

With Python 3.8, unpickling pynac objects gives a deprecation warning

{{{
DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats
}}}

These are fixed in this ticket by defining PY_SSIZE_T_CLEAN where
appropriate

Upstream pull request: pynac/pynac#354

URL: https://trac.sagemath.org/30225
Reported by: arojas
Ticket author(s): Antonio Rojas
Reviewer(s): Matthias Koeppe
  • Loading branch information
Release Manager committed Aug 6, 2020
2 parents 26f3a5e + ecc6f45 commit 760b7d8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build/pkgs/pynac/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.26.sage-2020-04-03
0.7.26.sage-2020-04-03.p0
45 changes: 45 additions & 0 deletions build/pkgs/pynac/patches/py_ssize_t_clean.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 37f3233e7eead521c25f798cab1df5746b9e8708 Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Sun, 26 Jul 2020 20:04:35 +0200
Subject: [PATCH 1/2] define PY_SSIZE_T_CLEAN

As required by python 3.8
---
ginac/function.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/ginac/function.cpp b/ginac/function.cpp
index c158723..689e2b8 100644
--- a/ginac/function.cpp
+++ b/ginac/function.cpp
@@ -21,6 +21,7 @@
*/

#define register
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "py_funcs.h"
#include "function.h"

From 0869189faf3899d6aeb07501e16719159f13cb2f Mon Sep 17 00:00:00 2001
From: Antonio Rojas <arojas@archlinux.org>
Date: Sun, 26 Jul 2020 20:05:19 +0200
Subject: [PATCH 2/2] define PY_SSIZE_T_CLEAN

As required by Python 3.8
---
ginac/numeric.cpp | 1 +
1 file changed, 1 insertion(+)

diff --git a/ginac/numeric.cpp b/ginac/numeric.cpp
index 276d86c..b463806 100644
--- a/ginac/numeric.cpp
+++ b/ginac/numeric.cpp
@@ -50,6 +50,7 @@
*/

#define register
+#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <longintrepr.h>
#include "flint/fmpz.h"

0 comments on commit 760b7d8

Please sign in to comment.