public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/python-executing] rawhide: Yet another fix for Python 3.15
@ 2026-06-13 17:06 Lumir Balhar
0 siblings, 0 replies; only message in thread
From: Lumir Balhar @ 2026-06-13 17:06 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/python-executing
Branch : rawhide
Commit : a47a8955874055643fb74776ec8de01dae0fdec4
Author : Lumir Balhar <lbalhar@redhat.com>
Date : 2026-06-13T18:53:51+02:00
Stats : +91/-0 in 2 file(s)
URL : https://src.fedoraproject.org/rpms/python-executing/c/a47a8955874055643fb74776ec8de01dae0fdec4?branch=rawhide
Log:
Yet another fix for Python 3.15
---
diff --git a/fix-py315-with-exit.patch b/fix-py315-with-exit.patch
new file mode 100644
index 0000000..b00ef65
--- /dev/null
+++ b/fix-py315-with-exit.patch
@@ -0,0 +1,88 @@
+--- a/executing/_position_node_finder.py 2026-06-13 11:28:42.055694618 +0000
++++ b/executing/_position_node_finder.py 2026-06-13 14:44:03.000528940 +0000
+@@ -220,7 +220,8 @@
+ before = self.instruction_before(instruction)
+ if (
+ before is not None
+- and before.opname == "LOAD_CONST"
++ and before.opname in ("LOAD_CONST", "LOAD_COMMON_CONSTANT")
++ and before.argval is None
+ and before.positions == instruction.positions
+ and isinstance(node.parent, ast.withitem)
+ and node is node.parent.context_expr
+@@ -272,6 +273,40 @@
+ ):
+ return node.parent.parent
+
++ if sys.version_info >= (3, 15) and instruction.opname in (
++ "CALL", "WITH_EXCEPT_START", "LOAD_SPECIAL"
++ ):
++ # In Python 3.15, __exit__ CALL, WITH_EXCEPT_START, and LOAD_SPECIAL
++ # positions match the context manager expression or sub-expression.
++ # Walk up the AST to find withitem context_expr.
++ n = node
++ with_node = None
++ ctx_is_call = False
++ while True:
++ p = getattr(n, 'parent', None)
++ if p is None:
++ break
++ if isinstance(p, ast.withitem) and n is p.context_expr:
++ with_node = p.parent
++ ctx_is_call = isinstance(n, ast.Call)
++ break
++ n = p
++
++ if with_node is not None:
++ if (
++ instruction.opname == "WITH_EXCEPT_START"
++ or not ctx_is_call
++ or (
++ instruction.opname == "LOAD_SPECIAL"
++ and instruction.argrepr in ("__exit__", "__aexit__")
++ )
++ ):
++ # Redirect to the With node: this instruction is from the
++ # with-statement's exit path, not the context manager call itself.
++ return with_node
++ # For Call context managers with CALL instruction: the extended
++ # 3.12.6 check (LOAD_COMMON_CONSTANT/LOAD_CONST before CALL) handles it.
++
+ if sys.version_info >= (3, 14) and isinstance(node, ast.UnaryOp) and isinstance(node.op,ast.Not) and instruction.opname !="UNARY_NOT":
+ # fix for https://github.com/python/cpython/issues/137843
+ return node.operand
+--- a/tests/test_main.py 2026-06-13 11:28:42.056290083 +0000
++++ b/tests/test_main.py 2026-06-13 15:18:58.765005297 +0000
+@@ -1046,6 +1046,20 @@
+ # `not not x` is optimized to a single TO_BOOL
+ continue
+
++ if sys.version_info >= (3, 15):
++ if (
++ isinstance(node, ast.Compare)
++ and len(node.ops) == 1
++ and any(
++ isinstance(c, ast.Constant) and isinstance(c.value, int)
++ for c in node.comparators
++ )
++ ):
++ # In Python 3.15, comparisons with integer literals use
++ # LOAD_SMALL_INT which is not tracked by check_code,
++ # causing the Compare node to have no associated instructions.
++ continue
++
+
+ # the deadcode check has to be the last check because it is expensive
+ if len(values)==0 and is_deadcode(node):
+@@ -1074,7 +1088,10 @@
+ p()
+
+ p("ast node:")
+- p(mangled_name(node))
++ try:
++ p(mangled_name(node))
++ except TypeError:
++ p(ast_dump(node))
+ p(ast_dump(node, indent=4))
+
+ parents = []
diff --git a/python-executing.spec b/python-executing.spec
index 69fd7e0..9775682 100644
--- a/python-executing.spec
+++ b/python-executing.spec
@@ -19,6 +19,9 @@ Source: %{forgesource}
# Python 3.15 compatibility
Patch: https://github.com/alexmojaki/executing/pull/102.patch
+# Fix Python 3.15 with-statement __exit__ CALL VerifierFailure
+# https://github.com/alexmojaki/executing/pull/107
+Patch: fix-py315-with-exit.patch
BuildArch: noarch
BuildRequires: python3-devel
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-06-13 17:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-13 17:06 [rpms/python-executing] rawhide: Yet another fix for Python 3.15 Lumir Balhar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox