public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-genshi] rawhide: Fix FTBFS with Python 3.15
@ 2026-06-02  6:01 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-06-02  6:01 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/python-genshi
Branch : rawhide
Commit : adece1839203187e9a1eccf2a4931effdabab383
Author : Lukáš Zachar <lzachar@redhat.com>
Date   : 2026-06-02T05:59:37+00:00
Stats  : +76/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/python-genshi/c/adece1839203187e9a1eccf2a4931effdabab383?branch=rawhide

Log:
Fix FTBFS with Python 3.15

---
diff --git a/93.patch b/93.patch
new file mode 100644
index 0000000..905c31b
--- /dev/null
+++ b/93.patch
@@ -0,0 +1,69 @@
+diff --git a/genshi/template/astutil.py b/genshi/template/astutil.py
+index c841aeb..0418964 100644
+--- a/genshi/template/astutil.py
++++ b/genshi/template/astutil.py
+@@ -802,7 +802,7 @@ class ASTTransformer(object):
+         return visitor(node)
+ 
+     def _clone(self, node):
+-        clone = node.__class__()
++        clone = construct_ast_class(node.__class__)
+         for name in getattr(clone, '_attributes', ()):
+             try:
+                 setattr(clone, name, getattr(node, name))
+@@ -887,3 +887,18 @@ class ASTTransformer(object):
+     visit_Index = _clone
+ 
+     del _clone
++
++
++def construct_ast_class(cls):
++    kwargs = {}
++    if hasattr(cls, '__annotations__'):
++        for name, typ in cls.__annotations__.items():
++            if typ is str:
++                kwargs[name] = 'foo'
++            elif typ is int:
++                kwargs[name] = 42
++            elif typ is object:
++                kwargs[name] = b'foo'
++            elif isinstance(typ, type) and issubclass(typ, _ast.AST):
++                kwargs[name] = construct_ast_class(typ)
++    return cls(**kwargs)
+diff --git a/genshi/template/eval.py b/genshi/template/eval.py
+index 82bddf3..0f45ab6 100644
+--- a/genshi/template/eval.py
++++ b/genshi/template/eval.py
+@@ -18,7 +18,8 @@ from types import CodeType
+ 
+ from genshi.compat import builtins, exec_, string_types, text_type
+ from genshi.core import Markup
+-from genshi.template.astutil import ASTTransformer, ASTCodeGenerator, parse
++from genshi.template.astutil import (
++    ASTTransformer, ASTCodeGenerator, parse, construct_ast_class)
+ from genshi.template.base import TemplateRuntimeError
+ from genshi.util import flatten
+ 
+@@ -59,11 +60,9 @@ class Code(object):
+                 'Expected string or AST node, but got %r' % source
+             self.source = '?'
+             if self.mode == 'eval':
+-                node = _ast.Expression()
+-                node.body = source
++                node = _ast.Expression(body=source)
+             else:
+-                node = _ast.Module()
+-                node.body = [source]
++                node = _ast.Module(body=[source])
+ 
+         self.ast = node
+         self.code = _compile(node, self.source, mode=self.mode,
+@@ -454,7 +453,7 @@ def _compile(node, source=None, mode='eval', filename=None, lineno=-1,
+ 
+ 
+ def _new(class_, *args, **kwargs):
+-    ret = class_()
++    ret = construct_ast_class(class_)
+     for attr, value in zip(ret._fields, args):
+         if attr in kwargs:
+             raise ValueError('Field set both in args and kwargs')

diff --git a/python-genshi.spec b/python-genshi.spec
index 46758c2..a6eb429 100644
--- a/python-genshi.spec
+++ b/python-genshi.spec
@@ -1,12 +1,14 @@
 Name:           python-genshi
 Version:        0.7.11
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        Toolkit for stream-based generation of output for the web
 
 License:        BSD-3-Clause
 URL:            https://genshi.edgewall.org/
 
 Source0:        %{pypi_source genshi}
+# https://github.com/edgewall/genshi/pull/93
+Patch:          93.patch
 
 BuildRequires:  gcc
 BuildRequires:  python3-devel
@@ -66,6 +68,10 @@ sed -i -e '/_speedups.c/d' %{pyproject_files}
 
 
 %changelog
+* Thu May 21 2026 Lukáš Zachar <lzachar@redhat.com> - 0.7.11-2
+- Fix FTBFS with Python 3.15
+- Fixes: rhbz#2479749
+
 * Mon May 18 2026 Felix Schwarz <fschwarz@fedoraproject.org> - 0.7.11-1
 - update to 0.7.11
 

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

only message in thread, other threads:[~2026-06-02  6:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02  6:01 [rpms/python-genshi] rawhide: Fix FTBFS with Python 3.15 

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