public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Jitka Plesnikova <jplesnik@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/pygsl] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
Date: Tue, 28 Jul 2026 15:21:05 GMT [thread overview]
Message-ID: <178525206542.1.17729655938788081173.rpms-pygsl-2ebe56bf697a@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/pygsl
Branch : rawhide
Commit : 2ebe56bf697accc6beb7b6786326f7fe82a3ec27
Author : Jitka Plesnikova <jplesnik@redhat.com>
Date : 2026-07-28T15:29:18+02:00
Stats : +323/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/pygsl/c/2ebe56bf697accc6beb7b6786326f7fe82a3ec27?branch=rawhide
Log:
Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
---
diff --git a/pygsl-swig45.patch b/pygsl-swig45.patch
new file mode 100644
index 0000000..3bb3219
--- /dev/null
+++ b/pygsl-swig45.patch
@@ -0,0 +1,320 @@
+diff -up pygsl-2.6.5/Include/pygsl/error_helpers.h.swig45 pygsl-2.6.5/Include/pygsl/error_helpers.h
+--- pygsl-2.6.5/Include/pygsl/error_helpers.h.swig45 2026-07-28 10:24:53.094176942 +0200
++++ pygsl-2.6.5/Include/pygsl/error_helpers.h 2026-07-28 10:24:53.137054157 +0200
+@@ -108,7 +108,7 @@ PyGSL_warning(const char *, const char*,
+ PyGSL_error_flag_to_pyint((long) (flag))
+ #else /* PyGSL_PY3K */
+ #define PyGSL_ERROR_FLAG_TO_PYINT(flag) \
+-(((long) flag <= 0) && (!PyErr_Occurred())) ? PyInt_FromLong((long) flag) : \
++(((long) flag <= 0) && (!PyErr_Occurred())) ? PyLong_FromLong((long) flag) : \
+ PyGSL_error_flag_to_pyint((long) (flag))
+ #endif /* PyGSL_PY3K */
+
+diff -up pygsl-2.6.5/Include/pygsl/general_helpers.h.swig45 pygsl-2.6.5/Include/pygsl/general_helpers.h
+--- pygsl-2.6.5/Include/pygsl/general_helpers.h.swig45 2026-07-28 10:24:53.105177167 +0200
++++ pygsl-2.6.5/Include/pygsl/general_helpers.h 2026-07-28 10:24:53.137177822 +0200
+@@ -113,9 +113,9 @@ PyGSL_clear_name(char *name, int size);
+ : PyGSL_pyint_to_int((object), (result), (info))
+ #else /* PyGSL_PY3K */
+ #define PyGSL_PYINT_TO_INT(object, result, info) \
+- ( PyInt_Check((object)) ) \
++ ( PyLong_Check((object)) ) \
+ ? \
+- ((*(result)) = (int) PyInt_AsLong((object)), GSL_SUCCESS) \
++ ((*(result)) = (int) PyLong_AsLong((object)), GSL_SUCCESS) \
+ : PyGSL_pyint_to_int((object), (result), (info))
+ #endif /* PyGSL_PY3K */
+
+diff -up pygsl-2.6.5/src/callback/function_helpers_multifit_nlinear.ic.swig45 pygsl-2.6.5/src/callback/function_helpers_multifit_nlinear.ic
+--- pygsl-2.6.5/src/callback/function_helpers_multifit_nlinear.ic.swig45 2026-07-28 14:24:28.719055825 +0200
++++ pygsl-2.6.5/src/callback/function_helpers_multifit_nlinear.ic 2026-07-28 14:24:46.381705107 +0200
+@@ -230,7 +230,7 @@ PyGSL_multifitorlarge_nlinear_driver_cal
+ goto fail;
+ }
+
+- niter_o = PyInt_FromLong((long) iter);
++ niter_o = PyLong_FromLong((long) iter);
+ if(!niter_o){
+ goto fail;
+ }
+diff -up pygsl-2.6.5/src/callback/gsl_multilarge_nlinear.i.swig45 pygsl-2.6.5/src/callback/gsl_multilarge_nlinear.i
+--- pygsl-2.6.5/src/callback/gsl_multilarge_nlinear.i.swig45 2026-07-28 10:24:53.106177188 +0200
++++ pygsl-2.6.5/src/callback/gsl_multilarge_nlinear.i 2026-07-28 10:24:53.138177843 +0200
+@@ -136,7 +136,7 @@ _pygsl_multilarge_nlinear_df (CBLAS_TRAN
+ trb_lineno = __LINE__ - 2;
+ goto fail;
+ }
+- transj_o = PyInt_FromLong((long) TransJ);
++ transj_o = PyLong_FromLong((long) TransJ);
+ if(transj_o == NULL){
+ trb_lineno = __LINE__ - 2;
+ goto fail;
+diff -up pygsl-2.6.5/src/diffmodule.c.swig45 pygsl-2.6.5/src/diffmodule.c
+--- pygsl-2.6.5/src/diffmodule.c.swig45 2026-07-28 10:24:53.108177229 +0200
++++ pygsl-2.6.5/src/diffmodule.c 2026-07-28 10:24:53.139185727 +0200
+@@ -93,7 +93,7 @@ DL_EXPORT(void) initdiff(void)
+ if (dict == NULL)
+ return;
+
+- if (!(item = PyString_FromString(diff_module_doc))){
++ if (!(item = PyUnicode_FromString(diff_module_doc))){
+ PyErr_SetString(PyExc_ImportError,
+ "I could not generate module doc string!");
+ return;
+diff -up pygsl-2.6.5/src/gslwrap/combination.i.swig45 pygsl-2.6.5/src/gslwrap/combination.i
+--- pygsl-2.6.5/src/gslwrap/combination.i.swig45 2026-07-28 10:24:53.109177249 +0200
++++ pygsl-2.6.5/src/gslwrap/combination.i 2026-07-28 10:24:53.139546362 +0200
+@@ -68,7 +68,7 @@ struct gsl_combination_struct
+ if (a_list == NULL)
+ return NULL;
+ for(i=0; i<size; i++){
+- a_int = PyInt_FromLong((long) gsl_combination_get(self, i));
++ a_int = PyLong_FromLong((long) gsl_combination_get(self, i));
+ if (a_int == NULL){
+ Py_DECREF(a_list);
+ return NULL;
+diff -up pygsl-2.6.5/src/gslwrap/permutation.i.swig45 pygsl-2.6.5/src/gslwrap/permutation.i
+--- pygsl-2.6.5/src/gslwrap/permutation.i.swig45 2026-07-28 10:24:53.111177290 +0200
++++ pygsl-2.6.5/src/gslwrap/permutation.i 2026-07-28 10:24:53.139884804 +0200
+@@ -93,7 +93,7 @@
+ if (a_list == NULL)
+ return NULL;
+ for(i=0; i<size; i++){
+- a_int = PyInt_FromLong((long) gsl_permutation_get(self, i));
++ a_int = PyLong_FromLong((long) gsl_permutation_get(self, i));
+ if (a_int == NULL){
+ Py_DECREF(a_list);
+ return NULL;
+diff -up pygsl-2.6.5/src/histogram/histogram_common.ic.swig45 pygsl-2.6.5/src/histogram/histogram_common.ic
+--- pygsl-2.6.5/src/histogram/histogram_common.ic.swig45 2026-07-28 14:24:28.722055884 +0200
++++ pygsl-2.6.5/src/histogram/histogram_common.ic 2026-07-28 14:24:46.383020134 +0200
+@@ -171,7 +171,7 @@ FUNCNAME(equal_bins_p)(PyObject *self, P
+ }
+
+ result=GSLNAME(equal_bins_p)(histogram,histogram2);
+- return PyInt_FromLong(result);
++ return PyLong_FromLong(result);
+ }
+
+ static void
+diff -up pygsl-2.6.5/src/histogram/histogram.ic.swig45 pygsl-2.6.5/src/histogram/histogram.ic
+--- pygsl-2.6.5/src/histogram/histogram.ic.swig45 2026-07-28 14:24:28.720055845 +0200
++++ pygsl-2.6.5/src/histogram/histogram.ic 2026-07-28 14:24:46.382356073 +0200
+@@ -392,7 +392,7 @@ histogram_histogram_mp_subscript(PyObjec
+ /* get key */
+ my_key=PyNumber_Long(key);
+ if (my_key==NULL) return NULL;
+- k=PyInt_AsLong(my_key);
++ k=PyLong_AsLong(my_key);
+ if (k<0 || k>=histogram->n) {
+ pygsl_error ("index lies outside valid range of 0 .. n - 1",
+ filename, __LINE__, GSL_EDOM );
+@@ -419,7 +419,7 @@ histogram_histogram_mp_ass_subscript(PyO
+ /* get key */
+ my_key=PyNumber_Long(key);
+ if (my_key==NULL) return -1;
+- k=PyInt_AsLong(my_key);
++ k=PyLong_AsLong(my_key);
+ if (k<0 || k>=histogram->n) {
+ pygsl_error ("index lies outside valid range of 0 .. n - 1",
+ filename, __LINE__, GSL_EDOM);
+diff -up pygsl-2.6.5/src/init/block_helpers.c.swig45 pygsl-2.6.5/src/init/block_helpers.c
+--- pygsl-2.6.5/src/init/block_helpers.c.swig45 2026-07-28 10:24:53.113177331 +0200
++++ pygsl-2.6.5/src/init/block_helpers.c 2026-07-28 10:24:53.140255421 +0200
+@@ -284,7 +284,7 @@ PyGSL_PyArray_Check(PyArrayObject *a_arr
+ #ifdef PyGSL_PY3K
+ #define _PyGSL_WRAP_LONG_FROM_PyObject(src) PyLong_AS_LONG(((src)))
+ #else
+-#define _PyGSL_WRAP_LONG_FROM_PyObject(src) ( PyInt_AsLong(((src))) )
++#define _PyGSL_WRAP_LONG_FROM_PyObject(src) ( PyLong_AsLong(((src))) )
+ #endif
+
+ static PyArrayObject *
+diff -up pygsl-2.6.5/src/multiminmodule.c.swig45 pygsl-2.6.5/src/multiminmodule.c
+--- pygsl-2.6.5/src/multiminmodule.c.swig45 2026-07-28 10:24:53.114177351 +0200
++++ pygsl-2.6.5/src/multiminmodule.c 2026-07-28 10:24:53.141177904 +0200
+@@ -177,7 +177,7 @@ static PyObject* multimin_multimin_itera
+ PyErr_SetString(PyExc_RuntimeError,"no function specified!");
+ return NULL;
+ }
+- return PyInt_FromLong(gsl_multimin_fminimizer_iterate(((multimin_multiminObject*)self)->min));
++ return PyLong_FromLong(gsl_multimin_fminimizer_iterate(((multimin_multiminObject*)self)->min));
+ }
+
+ static PyObject* multimin_multimin_x(PyObject *self,
+diff -up pygsl-2.6.5/src/qrngmodule.c.swig45 pygsl-2.6.5/src/qrngmodule.c
+--- pygsl-2.6.5/src/qrngmodule.c.swig45 2026-07-28 10:24:53.116177392 +0200
++++ pygsl-2.6.5/src/qrngmodule.c 2026-07-28 10:24:53.142220593 +0200
+@@ -14,8 +14,8 @@ static PyObject *module = NULL;
+ #define PyGSL_STRING_AS_STRING(obj) PyBytes_FromString(obj)
+ #define PyGSL_STRING_LENGTH(obj) PyBytes_Length(obj)
+ #else
+-#define PyGSL_STRING_AS_STRING(obj) PyString_AsString(obj)
+-#define PyGSL_STRING_LENGTH(obj) PyString_Size(obj)
++#define PyGSL_STRING_AS_STRING(obj) PyBytes_AsString(obj)
++#define PyGSL_STRING_LENGTH(obj) PyBytes_Size(obj)
+ #endif
+
+
+diff -up pygsl-2.6.5/src/sfmodule.c.swig45 pygsl-2.6.5/src/sfmodule.c
+--- pygsl-2.6.5/src/sfmodule.c.swig45 2026-07-28 10:24:53.117177413 +0200
++++ pygsl-2.6.5/src/sfmodule.c 2026-07-28 10:24:53.142793358 +0200
+@@ -40,7 +40,7 @@ int eval_gsl_mode_char(gsl_mode_t* mode,
+ gsl_error_dict=PyModule_GetDict(gsl_error_module);
+ gsl_error_object=PyDict_GetItemString(gsl_error_dict,"gsl_Error");
+ PyErr_SetObject(gsl_error_object,
+- PyString_FromString(error_text));
++ PyUnicode_FromString(error_text));
+
+ return -1;
+ }
+diff -up pygsl-2.6.5/src/statistics/charmodule.c.swig45 pygsl-2.6.5/src/statistics/charmodule.c
+--- pygsl-2.6.5/src/statistics/charmodule.c.swig45 2026-07-28 10:24:53.119177454 +0200
++++ pygsl-2.6.5/src/statistics/charmodule.c 2026-07-28 10:24:53.142924935 +0200
+@@ -23,7 +23,7 @@
+ #define STATMOD_APPEND_PYC_TYPE(X) X ## BYTE
+
+ #define STATMOD_FUNC_EXT(X, Y) X ## _char ## Y
+-#define STATMOD_PY_AS_C PyInt_AsLong
++#define STATMOD_PY_AS_C PyLong_AsLong
+ #define STATMOD_C_TYPE char
+ #include "functions.c"
+
+diff -up pygsl-2.6.5/src/statistics/intmodule.c.swig45 pygsl-2.6.5/src/statistics/intmodule.c
+--- pygsl-2.6.5/src/statistics/intmodule.c.swig45 2026-07-28 10:24:53.121177495 +0200
++++ pygsl-2.6.5/src/statistics/intmodule.c 2026-07-28 10:24:53.143024479 +0200
+@@ -20,7 +20,7 @@
+ #define STATMOD_APPEND_PY_TYPE(X) X ## Int
+ #define STATMOD_APPEND_PYC_TYPE(X) X ## INT
+ #define STATMOD_FUNC_EXT(X, Y) X ## _int ## Y
+-#define STATMOD_PY_AS_C PyInt_AsLong
++#define STATMOD_PY_AS_C PyLong_AsLong
+ #define STATMOD_C_TYPE int
+ #define PyGSL_STATISTICS_IMPORT_API
+ #include "functions.c"
+diff -up pygsl-2.6.5/src/statistics/longmodule.c.swig45 pygsl-2.6.5/src/statistics/longmodule.c
+--- pygsl-2.6.5/src/statistics/longmodule.c.swig45 2026-07-28 10:24:53.122177515 +0200
++++ pygsl-2.6.5/src/statistics/longmodule.c 2026-07-28 10:24:53.143116145 +0200
+@@ -20,7 +20,7 @@
+ #define STATMOD_APPEND_PY_TYPE(X) X ## Int
+ #define STATMOD_APPEND_PYC_TYPE(X) X ## LONG
+ #define STATMOD_FUNC_EXT(X, Y) X ## _long ## Y
+-#define STATMOD_PY_AS_C PyInt_AsLong
++#define STATMOD_PY_AS_C PyLong_AsLong
+ #define STATMOD_C_TYPE long int
+ #include "functions.c"
+
+diff -up pygsl-2.6.5/src/statistics/shortmodule.c.swig45 pygsl-2.6.5/src/statistics/shortmodule.c
+--- pygsl-2.6.5/src/statistics/shortmodule.c.swig45 2026-07-28 10:24:53.124177556 +0200
++++ pygsl-2.6.5/src/statistics/shortmodule.c 2026-07-28 10:24:53.143234846 +0200
+@@ -19,7 +19,7 @@
+ #define STATMOD_APPEND_PY_TYPE(X) X ## Int
+ #define STATMOD_APPEND_PYC_TYPE(X) X ## SHORT
+ #define STATMOD_FUNC_EXT(X, Y) X ## _short ## Y
+-#define STATMOD_PY_AS_C PyInt_AsLong
++#define STATMOD_PY_AS_C PyLong_AsLong
+ #define STATMOD_C_TYPE short int
+ #include "functions.c"
+
+diff -up pygsl-2.6.5/src/statistics/ucharmodule.c.swig45 pygsl-2.6.5/src/statistics/ucharmodule.c
+--- pygsl-2.6.5/src/statistics/ucharmodule.c.swig45 2026-07-28 10:24:53.125177577 +0200
++++ pygsl-2.6.5/src/statistics/ucharmodule.c 2026-07-28 10:24:53.143335641 +0200
+@@ -19,7 +19,7 @@
+ #define STATMOD_APPEND_PY_TYPE(X) X ## Int
+ #define STATMOD_APPEND_PYC_TYPE(X) X ## UBYTE
+ #define STATMOD_FUNC_EXT(X, Y) X ## _uchar ## Y
+-#define STATMOD_PY_AS_C PyInt_AsLong
++#define STATMOD_PY_AS_C PyLong_AsLong
+ #define STATMOD_C_TYPE unsigned char
+ #include "functions.c"
+
+diff -up pygsl-2.6.5/testing/src/multiminmodule.c.swig45 pygsl-2.6.5/testing/src/multiminmodule.c
+--- pygsl-2.6.5/testing/src/multiminmodule.c.swig45 2026-07-28 10:24:53.127177617 +0200
++++ pygsl-2.6.5/testing/src/multiminmodule.c 2026-07-28 10:24:53.143479246 +0200
+@@ -566,7 +566,7 @@ PyGSL_multimin_istype(PyGSL_multimin *se
+ p = fdf;
+ }
+ FUNC_MESS_END();
+- return PyString_FromString(p);
++ return PyUnicode_FromString(p);
+ }
+
+ static PyObject*
+diff -up pygsl-2.6.5/testing/src/solvers/minimize.c.swig45 pygsl-2.6.5/testing/src/solvers/minimize.c
+--- pygsl-2.6.5/testing/src/solvers/minimize.c.swig45 2026-07-28 10:24:53.129177658 +0200
++++ pygsl-2.6.5/testing/src/solvers/minimize.c 2026-07-28 10:24:53.144565034 +0200
+@@ -60,7 +60,7 @@ PyGSL_min_solver_test_interval(PyGSL_sol
+ gsl_min_fminimizer *s = (gsl_min_fminimizer *) self->solver;
+ if(!PyArg_ParseTuple(args, "dd", &epsabs, &epsrel))
+ return NULL;
+- return PyInt_FromLong(gsl_min_test_interval(s->x_lower, s->x_upper, epsabs, epsrel));
++ return PyLong_FromLong(gsl_min_test_interval(s->x_lower, s->x_upper, epsabs, epsrel));
+ }
+
+
+@@ -126,7 +126,7 @@ PyGSL_min_test_interval(PyObject * self,
+ double x_lower, x_upper, epsabs, epsrel;
+ if(!PyArg_ParseTuple(args, "dddd", &x_lower, &x_upper, &epsabs, &epsrel))
+ return NULL;
+- return PyInt_FromLong(gsl_min_test_interval(x_lower, x_upper, epsabs, epsrel));
++ return PyLong_FromLong(gsl_min_test_interval(x_lower, x_upper, epsabs, epsrel));
+ }
+
+ static const char PyGSL_minimize_module_doc [] = "XXX Missing ";
+@@ -155,7 +155,7 @@ initminimize(void)
+ if(!dict)
+ goto fail;
+
+- if (!(item = PyString_FromString((char*)PyGSL_minimize_module_doc))){
++ if (!(item = PyUnicode_FromString((char*)PyGSL_minimize_module_doc))){
+ PyErr_SetString(PyExc_ImportError,
+ "I could not generate module doc string!");
+ goto fail;
+diff -up pygsl-2.6.5/testing/src/solvers/monte.c.swig45 pygsl-2.6.5/testing/src/solvers/monte.c
+--- pygsl-2.6.5/testing/src/solvers/monte.c.swig45 2026-07-28 10:24:53.130177679 +0200
++++ pygsl-2.6.5/testing/src/solvers/monte.c 2026-07-28 10:24:53.145177986 +0200
+@@ -505,7 +505,7 @@ initmonte(void)
+ assert(PyGSL_API);
+
+
+- if (!(item = PyString_FromString((char*)module_doc))){
++ if (!(item = PyUnicode_FromString((char*)module_doc))){
+ PyErr_SetString(PyExc_ImportError,
+ "I could not generate module doc string!");
+ goto fail;
+diff -up pygsl-2.6.5/testing/src/solvers/multifit_nlin.c.swig45 pygsl-2.6.5/testing/src/solvers/multifit_nlin.c
+--- pygsl-2.6.5/testing/src/solvers/multifit_nlin.c.swig45 2026-07-28 10:24:53.132177720 +0200
++++ pygsl-2.6.5/testing/src/solvers/multifit_nlin.c 2026-07-28 10:24:53.145931405 +0200
+@@ -335,7 +335,7 @@ initmultifit_nlin(void)
+ assert(PyGSL_API);
+
+
+- if (!(item = PyString_FromString((char*)PyGSL_multifit_nlin_module_doc))){
++ if (!(item = PyUnicode_FromString((char*)PyGSL_multifit_nlin_module_doc))){
+ PyErr_SetString(PyExc_ImportError,
+ "I could not generate module doc string!");
+ goto fail;
+diff -up pygsl-2.6.5/testing/src/solvers/multiroot.c.swig45 pygsl-2.6.5/testing/src/solvers/multiroot.c
+--- pygsl-2.6.5/testing/src/solvers/multiroot.c.swig45 2026-07-28 10:24:53.133177740 +0200
++++ pygsl-2.6.5/testing/src/solvers/multiroot.c 2026-07-28 10:24:53.146722955 +0200
+@@ -308,7 +308,7 @@ initmultiroot(void)
+ if(!dict)
+ goto fail;
+
+- if (!(item = PyString_FromString((char*)PyGSL_multiroot_module_doc))){
++ if (!(item = PyUnicode_FromString((char*)PyGSL_multiroot_module_doc))){
+ PyErr_SetString(PyExc_ImportError,
+ "I could not generate module doc string!");
+ goto fail;
+diff -up pygsl-2.6.5/typemaps/misc_typemaps.i.swig45 pygsl-2.6.5/typemaps/misc_typemaps.i
+--- pygsl-2.6.5/typemaps/misc_typemaps.i.swig45 2026-07-28 10:24:53.134177761 +0200
++++ pygsl-2.6.5/typemaps/misc_typemaps.i 2026-07-28 10:24:53.147280766 +0200
+@@ -13,7 +13,7 @@
+ %}
+ %typemap(argout) size_t * OUTPUT{
+ PyObject *o;
+- o = PyInt_FromLong((long) (*$1));
++ o = PyLong_FromLong((long) (*$1));
+ $result = PyGSL_SWIG_Python_AppendOutput($result, o);
+ }
+ %typemap(in, numinputs=0) size_t * OUT = size_t * OUTPUT;
diff --git a/pygsl.spec b/pygsl.spec
index 97093ed..f07ead0 100644
--- a/pygsl.spec
+++ b/pygsl.spec
@@ -25,6 +25,9 @@ Patch: %{name}-rng-test.patch
Patch: %{name}-incompatible-pointer.patch
# Fix warnings due to printf format mismatches
Patch: %{name}-format-mismatch.patch
+# Replace removed Python 2 C API macros with Python 3 equivalents
+# for compatibility with SWIG 4.5.0
+Patch: %{name}-swig45.patch
# Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}
reply other threads:[~2026-07-28 15:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178525206542.1.17729655938788081173.rpms-pygsl-2ebe56bf697a@fedoraproject.org \
--to=jplesnik@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox