Blame SOURCES/00338-fix-test_gdb-for-LTO.patch

f8e6ca
diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
f8e6ca
index 9c15fca..c972409 100644
f8e6ca
--- a/Lib/test/test_gdb.py
f8e6ca
+++ b/Lib/test/test_gdb.py
f8e6ca
@@ -279,8 +279,15 @@ class DebuggerTests(unittest.TestCase):
f8e6ca
         # gdb can insert additional '\n' and space characters in various places
f8e6ca
         # in its output, depending on the width of the terminal it's connected
f8e6ca
         # to (using its "wrap_here" function)
f8e6ca
-        m = re.match(r'.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*',
f8e6ca
-                     gdb_output, re.DOTALL)
f8e6ca
+        m = re.search(
f8e6ca
+            # Match '#0 builtin_id(self=..., v=...)'
f8e6ca
+            r'#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)?\)'
f8e6ca
+            # Match ' at Python/bltinmodule.c'.
f8e6ca
+            # bpo-38239: builtin_id() is defined in Python/bltinmodule.c,
f8e6ca
+            # but accept any "Directory\file.c" to support Link Time
f8e6ca
+            # Optimization (LTO).
f8e6ca
+            r'\s+at\s+\S*[A-Za-z]+/[A-Za-z0-9_-]+\.c',
f8e6ca
+            gdb_output, re.DOTALL)
f8e6ca
         if not m:
f8e6ca
             self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
f8e6ca
         return m.group(1), gdb_output