public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/kitty] rawhide: Fix build with Python 3.15
Date: Tue, 22 Sep 2026 11:56:56 GMT	[thread overview]
Message-ID: <179007821655.1.16753664329635678565.rpms-kitty-272b96a0fd34@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/kitty
            Branch : rawhide
            Commit : 272b96a0fd34093c8ba49f4e926d58bc56a8229a
            Author : Miro Hrončok <miro@hroncok.cz>
            Date   : 2026-09-21T20:41:51+02:00
            Stats  : +124/-0 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/kitty/c/272b96a0fd34093c8ba49f4e926d58bc56a8229a?branch=rawhide

            Log:
            Fix build with Python 3.15

- Fixes: rhbz#2504198

The downstream-only LLM-assisted patch "fixes" 15+ test errors, namely due to:

    DeprecationWarning: This process (pid=...) is multi-threaded, use of forkpty() may lead to deadlocks in the child.

Treating DeprecationWarnings as errors is extremely valuable upstream, but does not bring much to downstream packaging.

The remaining 2 failures/errors were investigated by LLM
and the fix it offered was later reviewed by me, @encukou, @ksurma,
and offered upstream.

Assisted-By: Claude Opus 4.8

---
diff --git a/10491.patch b/10491.patch
new file mode 100644
index 0000000..0029cf1
--- /dev/null
+++ b/10491.patch
@@ -0,0 +1,72 @@
+From 6a92acdd8411925e35090298251b38d81f2c8109 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 17 Sep 2026 11:35:52 +0200
+Subject: [PATCH 1/2] Don't use a capturing group in the re.Scanner lexicon
+
+Python 3.15 forbids capturing groups in re.Scanner lexicon patterns and
+raises:
+
+    ValueError: Cannot use capturing groups in re.Scanner
+
+See https://github.com/python/cpython/issues/140797 and
+https://github.com/python/cpython/commit/fa9c3eefd47
+
+Co-Authored-By: Kovid Goyal <kovid@kovidgoyal.net>
+
+Cherry-picked from https://github.com/kovidgoyal/calibre/commit/b80ae9b0e93a1fb73ca87de4698fea1df8fa7fb4
+
+I used LLM to analyze the issue, then @befeleme found the commit from calibre.
+---
+ kitty/search_query_parser.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kitty/search_query_parser.py b/kitty/search_query_parser.py
+index 51a6f7c..6fcab4e 100644
+--- a/kitty/search_query_parser.py
++++ b/kitty/search_query_parser.py
+@@ -125,7 +125,7 @@ def lex_scanner() -> Callable[[str], tuple[list[Token], str]]:
+             (r'[()]', lambda x, t: Token(TokenType.OPCODE, t)),
+             (r'@.+?:[^")\s]+', lambda x, t: Token(TokenType.WORD, str(t))),
+             (r'[^"()\s]+', lambda x, t: Token(TokenType.WORD, str(t))),
+-            (r'".*?((?<!\\)")', lambda x, t: Token(TokenType.QUOTED_WORD, t[1:-1])),
++            (r'".*?(?:(?<!\\)")', lambda x, t: Token(TokenType.QUOTED_WORD, t[1:-1])),
+             (r'\s+',              None)
+     ], flags=re.DOTALL).scan
+ 
+-- 
+2.55.0
+
+
+From b93642152a22d6fe629a86ff0a750679febd70cd Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Thu, 17 Sep 2026 11:43:05 +0200
+Subject: [PATCH 2/2] Don't use a non-capturing group in the re.Scanner lexicon
+ either
+
+As @encukou pointed out during Fedora PR review in
+https://src.fedoraproject.org/rpms/kitty/pull-request/10#comment-339615
+
+> The parentheses look unnecessary;
+> rather than convert to a non-capturing group they could be removed.
+
+Co-Authored-By: Petr Viktorin <encukou@gmail.com>
+---
+ kitty/search_query_parser.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kitty/search_query_parser.py b/kitty/search_query_parser.py
+index 6fcab4e..9ceb8af 100644
+--- a/kitty/search_query_parser.py
++++ b/kitty/search_query_parser.py
+@@ -125,7 +125,7 @@ def lex_scanner() -> Callable[[str], tuple[list[Token], str]]:
+             (r'[()]', lambda x, t: Token(TokenType.OPCODE, t)),
+             (r'@.+?:[^")\s]+', lambda x, t: Token(TokenType.WORD, str(t))),
+             (r'[^"()\s]+', lambda x, t: Token(TokenType.WORD, str(t))),
+-            (r'".*?(?:(?<!\\)")', lambda x, t: Token(TokenType.QUOTED_WORD, t[1:-1])),
++            (r'".*?(?<!\\)"', lambda x, t: Token(TokenType.QUOTED_WORD, t[1:-1])),
+             (r'\s+',              None)
+     ], flags=re.DOTALL).scan
+ 
+-- 
+2.55.0
+

diff --git a/kitty-do-not-treat-DeprecationWarnings-as-errors-in-tests.patch b/kitty-do-not-treat-DeprecationWarnings-as-errors-in-tests.patch
new file mode 100644
index 0000000..47b2760
--- /dev/null
+++ b/kitty-do-not-treat-DeprecationWarnings-as-errors-in-tests.patch
@@ -0,0 +1,44 @@
+From f36c06ad04f2214cb399df7296fd70e6c61bb305 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
+Date: Mon, 24 Aug 2026 13:53:25 +0200
+Subject: [PATCH] Don't treat DeprecationWarnings as errors in the test suite
+
+The test runner turns all warnings into errors, both in-process via
+warnings.simplefilter('error') and in spawned subprocesses via
+PYTHONWARNINGS='error'. That makes the suite fail on DeprecationWarnings
+emitted by newer Python versions and their standard library, which is
+not useful for a downstream distribution build.
+
+Downgrade DeprecationWarning back to its default (print, don't raise)
+in both places while keeping every other warning category fatal.
+
+This is a downstream-only change; upstream intentionally treats
+deprecations as errors to catch them early.
+
+Assisted-By: Claude Opus 4.8
+---
+ kitty_tests/main.py | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/kitty_tests/main.py b/kitty_tests/main.py
+index 9315e1746..10ac73ab1 100644
+--- a/kitty_tests/main.py
++++ b/kitty_tests/main.py
+@@ -332,7 +332,7 @@ def env_for_python_tests(report_env: bool = False) -> Iterator[None]:
+         XDG_DATA_DIRS=os.path.join(tdir, '.local', 'xdg'),
+         XDG_CACHE_HOME=os.path.join(tdir, '.cache'),
+         XDG_RUNTIME_DIR=os.path.join(tdir, '.cache', 'run'),
+-        PYTHONWARNINGS='error',
++        PYTHONWARNINGS='error,default::DeprecationWarning',
+     ):
+         if os.path.isdir(gohome):
+             os.symlink(gohome, os.path.join(tdir, os.path.basename(gohome)))
+@@ -343,4 +343,5 @@ def main() -> None:
+     import warnings
+ 
+     warnings.simplefilter('error')
++    warnings.simplefilter('default', DeprecationWarning)
+     run_tests()
+-- 
+2.55.0
+

diff --git a/kitty.spec b/kitty.spec
index 1ebbac6..8e7ce61 100644
--- a/kitty.spec
+++ b/kitty.spec
@@ -35,6 +35,14 @@ Source4:        go-vendor-tools.toml
 Source5:        https://raw.githubusercontent.com/kovidgoyal/kitty/46c0951751444e4f4994008f0d2dcb41e49389f4/kitty/data/%{name}.appdata.xml
 Source6:        https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/NerdFontsSymbolsOnly.tar.xz
 
+# Don't fail the test suite on DeprecationWarnings (downstream-only)
+Patch:          kitty-do-not-treat-DeprecationWarnings-as-errors-in-tests.patch
+
+# Python 3.15 forbids capturing groups in re.Scanner lexicon patterns
+# see https://github.com/python/cpython/issues/140797
+# https://github.com/kovidgoyal/kitty/pull/10491 rebased
+Patch:          10491.patch
+
 # https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
 ExcludeArch:    %{ix86}
 

                 reply	other threads:[~2026-09-22 11:56 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=179007821655.1.16753664329635678565.rpms-kitty-272b96a0fd34@fedoraproject.org \
    --to=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