From: mattip <matti.picus@gmail.com>
Date: Mon, 21 Sep 2026 22:40:09 +0300
Subject: fix translation on cpython2.7

Origin: upstream, https://github.com/pypy/pypy/commit/ad5d1d2f333ce8247b7b93d561ae89df45c01d71
Bug-Upstream: https://github.com/pypy/pypy/issues/5586
---
 rpython/rtyper/lltypesystem/rstr.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/rpython/rtyper/lltypesystem/rstr.py b/rpython/rtyper/lltypesystem/rstr.py
index aa6633b..b319072 100644
--- a/rpython/rtyper/lltypesystem/rstr.py
+++ b/rpython/rtyper/lltypesystem/rstr.py
@@ -776,9 +776,14 @@ class LLHelpers(AbstractLLHelpers):
         from rpython.rlib import rstring
         tp = typeOf(s1)
         if tp == string_repr.lowleveltype or tp == Char:
-            return rstring._search(hlstr(s1), hlstr(s2), start, end, mode)
+            value = hlstr(s1)
+            other = hlstr(s2)
         else:
-            return rstring._search(hlunicode(s1), hlunicode(s2), start, end, mode)
+            value = hlunicode(s1)
+            other = hlunicode(s2)
+        assert value is not None
+        assert other is not None
+        return rstring._search(value, other, start, end, mode)
 
     @staticmethod
     @signature(types.int(), types.any(), types.any(), returns=types.any())
