Control: tags -1 +patch

Attached is a patch originating from the Fedora project fixing the
reported test failures with Python 3.15. This has been submitted
upstream as a Github PR, but has not been merged at least so far.

-- 
Arto Jantunen

>From 83aa4a44b062fdb4760e0d4fcd7edd9e3df65ce4 Mon Sep 17 00:00:00 2001
From: Arto Jantunen <[email protected]>
Date: Sat, 17 Oct 2026 13:25:44 +0300
Subject: [PATCH] Apply Fedora patch for Python 3.15 support

---
 debian/patches/1002_support_python_315.patch | 40 ++++++++++++++++++++
 debian/patches/series                        |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 debian/patches/1002_support_python_315.patch

diff --git a/debian/patches/1002_support_python_315.patch b/debian/patches/1002_support_python_315.patch
new file mode 100644
index 000000000000..ae6386329a05
--- /dev/null
+++ b/debian/patches/1002_support_python_315.patch
@@ -0,0 +1,40 @@
+From bc181c736c191883dae8646f10bb176e2820bb5f Mon Sep 17 00:00:00 2001
+From: Filipe Rosset <rosset.filipe%40gmail.com>
+Date: Tue, 9 Jun 2026 07:53:49 -0400
+Subject: strptime: monkey patch for day-without-year behavior
+
+Origin: https://github.com/pimutils/khal/pull/1470
+Bug-Debian: https://bugs.debian.org/1149368
+
+---
+ khal/__init__.py | 20 ++++++++++++++++++++
+ 1 file changed, 20 insertions(+)
+
+diff --git a/khal/__init__.py b/khal/__init__.py
+index 36b60842b..e02c37c48 100644
+--- a/khal/__init__.py
++++ b/khal/__init__.py
+@@ -39,3 +39,23 @@
+ __description__ = "A standards based terminal calendar"
+ __license__ = "Expat/MIT, see COPYING"
+ __homepage__ = "https://lostpackets.de/khal/";
++
++
++# Monkeypatch _strptime to support Python 3.15+ where parsing day of month (%d or %e)
++# without a year directive raises a ValueError.
++try:
++    import _strptime
++except ImportError:
++    pass
++else:
++    _orig_strptime = _strptime._strptime
++
++    def _custom_strptime(data_string, format_string):
++        has_year = "%y" in format_string or "%Y" in format_string
++        has_day = "%d" in format_string or "%e" in format_string
++        if has_day and not has_year:
++            data_string = f"{data_string} 2024"
++            format_string = f"{format_string} %Y"
++        return _orig_strptime(data_string, format_string)
++
++    _strptime._strptime = _custom_strptime
diff --git a/debian/patches/series b/debian/patches/series
index 662468c6fa70..3b90320ee69c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,4 +1,5 @@
 1001_shebang.patch
+1002_support_python_315.patch
 2001_No_RSS_news_in_docs.patch
 2002_Fix_intersphinx_mapping.patch
 2003_Avoid_privacy_breach_in_sphinx_doc.patch
-- 
2.53.0

Reply via email to