10000 bpo-38239: Fix test_gdb for Link Time Optimization (LTO) (GH-16422) (… · python/cpython@e6b5ed1 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6b5ed1

Browse files
authored
bpo-38239: Fix test_gdb for Link Time Optimization (LTO) (GH-16422) (GH-16426)
(cherry picked from commit 64b4a3a)
1 parent 5017a64 commit e6b5ed1

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
@@ -252,8 +252,15 @@ def get_gdb_repr(self, source,
252252
# gdb can insert additional '\n' and space characters in various places
253253
# in its output, depending on the width of the terminal it's connected
254254
# to (using its "wrap_here" function)
255-
m = re.match(r'.*#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)\)\s+at\s+\S*Python/bltinmodule.c.*',
256-
gdb_output, re.DOTALL)
255+
m = re.search(
256+
# Match '#0 builtin_id(self=..., v=...)'
257+
r'#0\s+builtin_id\s+\(self\=.*,\s+v=\s*(.*?)?\)'
258+
# Match ' at Python/bltinmodule.c'.
259+
# bpo-38239: builtin_id() is defined in Python/bltinmodule.c,
260+
# but accept any "Directory\file.c" to support Link Time
261+
# Optimization (LTO).
262+
r'\s+at\s+\S*[A-Za-z]+/[A-Za-z0-9_-]+\.c',
263+
gdb_output, re.DOTALL)
257264
if not m:
258265
self.fail('Unexpected gdb output: %r\n%s' % (gdb_output, gdb_output))
259266
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)
0