public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Lumir Balhar <lbalhar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/python-executing] rawhide: Yet another fix for Python 3.15
Date: Sat, 13 Jun 2026 17:06:58 GMT [thread overview]
Message-ID: <178137041831.1.12593000230803691556.rpms-python-executing-a47a89558740@fedoraproject.org> (raw)
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
reply other threads:[~2026-06-13 17:06 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=178137041831.1.12593000230803691556.rpms-python-executing-a47a89558740@fedoraproject.org \
--to=lbalhar@redhat.com \
--cc=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