public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/gdcm] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility
@ 2026-07-29  8:42 Jitka Plesnikova
  0 siblings, 0 replies; only message in thread
From: Jitka Plesnikova @ 2026-07-29  8:42 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/gdcm
Branch : rawhide
Commit : 494405130139a01e899dc52dc0b50143ea37eddf
Author : Jitka Plesnikova <jplesnik@redhat.com>
Date   : 2026-07-28T15:29:18+02:00
Stats  : +41/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/gdcm/c/494405130139a01e899dc52dc0b50143ea37eddf?branch=rawhide

Log:
Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility

---
diff --git a/gdcm-swig45.patch b/gdcm-swig45.patch
new file mode 100644
index 0000000..eb24a38
--- /dev/null
+++ b/gdcm-swig45.patch
@@ -0,0 +1,38 @@
+diff -up GDCM-3.0.24/Wrapping/Python/gdcmswig.i.swig45 GDCM-3.0.24/Wrapping/Python/gdcmswig.i
+--- GDCM-3.0.24/Wrapping/Python/gdcmswig.i.swig45	2026-07-27 17:29:11.335129955 +0200
++++ GDCM-3.0.24/Wrapping/Python/gdcmswig.i	2026-07-27 17:29:11.338741795 +0200
+@@ -338,11 +338,11 @@ EXTEND_CLASS_PRINT(gdcm::ByteValue)
+ %template(SmartPtrSQ) gdcm::SmartPointer<gdcm::SequenceOfItems>;
+ %template(SmartPtrFrag) gdcm::SmartPointer<gdcm::SequenceOfFragments>;
+ %typemap(in) (const char* array, uint32_t length) {
+-  $1 = PyString_AsString($input);
++  $1 = PyBytes_AsString($input);
+   if ($1 == NULL) {
+     SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '$symname', argument $argnum expected byte string.");
+   }
+-  Py_ssize_t length = PyString_Size($input);
++  Py_ssize_t length = PyBytes_Size($input);
+   if (static_cast<size_t>(length) > std::numeric_limits<uint32_t>::max()) {
+     SWIG_exception_fail(SWIG_ArgError(SWIG_OverflowError), "in method '$symname', array in argument $argnum is too large.");
+   }
+@@ -408,7 +408,7 @@ EXTEND_CLASS_PRINT(gdcm::File)
+  int n = arg1->GetNumberOfDimensions();
+  $result = PyList_New(n);
+  for (i = 0; i < n; i++) {
+-   PyObject *o = PyInt_FromLong((long) $1[i]);
++   PyObject *o = PyLong_FromLong((long) $1[i]);
+    PyList_SetItem($result,i,o);
+  }
+ }
+diff -up GDCM-3.0.24/Wrapping/SWIGCommon/gdcmcommon.i.swig45 GDCM-3.0.24/Wrapping/SWIGCommon/gdcmcommon.i
+--- GDCM-3.0.24/Wrapping/SWIGCommon/gdcmcommon.i.swig45	2026-07-27 17:29:11.336129976 +0200
++++ GDCM-3.0.24/Wrapping/SWIGCommon/gdcmcommon.i	2026-07-27 17:29:11.340094631 +0200
+@@ -403,7 +403,7 @@ using namespace gdcm;
+  int n = arg1->GetNumberOfDimensions();
+  $result = PyList_New(n);
+  for (i = 0; i < n; i++) {
+-   PyObject *o = PyInt_FromLong((long) $1[i]);
++   PyObject *o = PyLong_FromLong((long) $1[i]);
+    PyList_SetItem($result,i,o);
+  }
+ }

diff --git a/gdcm.spec b/gdcm.spec
index 3b44844..96e9b43 100644
--- a/gdcm.spec
+++ b/gdcm.spec
@@ -25,6 +25,9 @@ Patch2: 0002-Fix-export-variables.patch
 Patch3: 0003-fix-set-C-23-for-poppler-usage.patch
 # Sent upstream: https://github.com/malaterre/GDCM/pull/205
 Patch4: 0004-fix-GooString-use-std-string-size.patch
+# Replace removed Python 2 C API macros with Python 3 equivalents
+# for compatibility with SWIG 4.5.0
+Patch5: gdcm-swig45.patch
 
 BuildRequires:  CharLS-devel >= 2.2
 BuildRequires:  cmake

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-07-29  8:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-29  8:42 [rpms/gdcm] rawhide: Replace removed Python 2 C API macros for SWIG 4.5.0 compatibility Jitka Plesnikova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox