Skip to content

Commit c989340

Browse files
bpo-38239: Fix test_gdb for Link Time Optimization (LTO) (GH-16422)
(cherry picked from commit 64b4a3a) Co-authored-by: Victor Stinner <[email protected]>
1 parent 96c8475 commit c989340

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Lib/test/test_gdb.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,15 @@ def get_gdb_repr(self, source,
255255
# gdb can insert additional '\n' and space characters in various places
256256
# in its output, depending on the width of the terminal it's connected
257257
# to (using its "wrap_here" function)
258-
m = re.match(r'.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)?\)\s+at\s+\S*Python/bltinmodule.c.*',
259-
gdb_output, re.DOTALL)
258+
m = re.search(
259+
# Match '#0 builtin_id(self=..., v=...)'
260+
r'#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)?\)'
261+
# Match ' at Python/bltinmodule.c'.
262+
# bpo-38239: builtin_id() is defined in Python/bltinmodule.c,
263+
# but accept any "Directory\file.c" to support Link Time
264+
# Optimization (LTO).
265+
r'\s+at\s+\S*[A-Za-z]+/[A-Za-z0-9_-]+\.c',
266+
gdb_output, re.DOTALL)
260267
if not m:
261268
self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
262269
return m.group(1), gdb_output
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix test_gdb for Link Time Optimization (LTO) builds.

0 commit comments

Comments
 (0)