swig/swig-python-Python-3.13-strips-docstring-indent.patch
Yaakov Selkowitz b2f85aac64 Rebuild for Python 3.13
Requires upstream commits from https://github.com/swig/swig/pull/2925
2024-06-23 18:10:30 -04:00

34 lines
1.1 KiB
Diff

From ffa856c8dc1fa97e6896a2c5d5bd647c15df2284 Mon Sep 17 00:00:00 2001
From: Julien Schueller <schueller@phimeca.com>
Date: Thu, 13 Jun 2024 15:31:26 +0200
Subject: [PATCH] Python 3.13 strips docstring indent
---
Examples/test-suite/python/python_docstring_runme.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Examples/test-suite/python/python_docstring_runme.py b/Examples/test-suite/python/python_docstring_runme.py
index a601ecb5430..101f9dd8a30 100644
--- a/Examples/test-suite/python/python_docstring_runme.py
+++ b/Examples/test-suite/python/python_docstring_runme.py
@@ -1,5 +1,6 @@
from python_docstring import *
import inspect
+import sys
def check(got, expected):
expected_list = expected.split("\n")
@@ -87,9 +88,10 @@ def check(got, expected):
)
# One line doc special case, use __doc__
-check(DocStrings.docstringX.__doc__,
- " one line docs"
- )
+if sys.version_info[0:2] < (3, 13):
+ check(DocStrings.docstringX.__doc__, " one line docs")
+else:
+ check(DocStrings.docstringX.__doc__, "one line docs")
check(inspect.getdoc(DocStrings.docstringX),
"one line docs"