Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaa93eb1

Browse files
committed
Adjust stack trace parsing for newer Python
1 parentdf9cef3 commitaa93eb1

File tree

2 files changed

+54
-10
lines changed

2 files changed

+54
-10
lines changed

‎qutebrowser/misc/crashdialog.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def parse_fatal_stacktrace(text):
4848
lines= [
4949
r'(?P<type>Fatal Python error|Windows fatal exception): (?P<msg>.*)',
5050
r' *',
51-
r'(Current )?[Tt]hread[^ ]* \(most recent call first\): *',
52-
r' File ".*", line \d+ in (?P<func>.*)',
51+
r'(Current )?[Tt]hread.* \(most recent call first\): *',
52+
r'(File ".*", line \d+ in (?P<func>.*)|<no Python frame>)',
5353
]
5454
m=re.search('\n'.join(lines),text)
5555
ifmisNone:
@@ -58,7 +58,7 @@ def parse_fatal_stacktrace(text):
5858
else:
5959
msg=m.group('msg')
6060
typ=m.group('type')
61-
func=m.group('func')
61+
func=m.group('func')or''
6262
iftyp=='Windows fatal exception':
6363
msg='Windows '+msg
6464
returnmsg,func

‎tests/unit/misc/test_crashdialog.py‎

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,31 @@
3232
File "", line 1 in testfunc
3333
"""
3434

35+
VALID_CRASH_TEXT_PY314="""
36+
Fatal Python error: Segmentation fault
37+
_
38+
Current thread 0x00000001fe53e140 [CrBrowserMain] (most recent call first):
39+
File "qutebrowser/app.py", line 126 in qt_mainloop
40+
File "qutebrowser/app.py", line 116 in run
41+
File "qutebrowser/qutebrowser.py", line 234 in main
42+
File "__main__.py", line 15 in <module>
43+
_
44+
Current thread's C stack trace (most recent call first):
45+
Binary file "...", at _Py_DumpStack+0x48 [0x10227cc9c]
46+
<truncated rest of calls>
47+
"""
48+
49+
VALID_CRASH_TEXT_PY314_NO_PY="""
50+
Fatal Python error: Segmentation fault
51+
_
52+
Current thread 0x00007f0dc805cbc0 [qutebrowser] (most recent call first):
53+
<no Python frame>
54+
_
55+
Current thread's C stack trace (most recent call first):
56+
Binary file "/lib64/libpython3.14.so.1.0", at _Py_DumpStack+0x4c [0x7f0dc7b2127b]
57+
<truncated rest of calls>
58+
"""
59+
3560
WINDOWS_CRASH_TEXT=r"""
3661
Windows fatal exception: access violation
3762
_
@@ -45,13 +70,32 @@
4570
"""
4671

4772

48-
@pytest.mark.parametrize('text, typ, func', [
49-
(VALID_CRASH_TEXT,'Segmentation fault','testfunc'),
50-
(VALID_CRASH_TEXT_THREAD,'Segmentation fault','testfunc'),
51-
(VALID_CRASH_TEXT_EMPTY,'Aborted',''),
52-
(WINDOWS_CRASH_TEXT,'Windows access violation','tabopen'),
53-
(INVALID_CRASH_TEXT,'',''),
54-
])
73+
@pytest.mark.parametrize(
74+
"text, typ, func",
75+
[
76+
pytest.param(VALID_CRASH_TEXT,"Segmentation fault","testfunc",id="valid"),
77+
pytest.param(
78+
VALID_CRASH_TEXT_THREAD,"Segmentation fault","testfunc",id="valid-thread"
79+
),
80+
pytest.param(
81+
VALID_CRASH_TEXT_PY314,
82+
"Segmentation fault",
83+
"qt mainloop",
84+
id="valid-py314",
85+
),
86+
pytest.param(
87+
VALID_CRASH_TEXT_PY314_NO_PY,
88+
"Segmentation fault",
89+
"",
90+
id="valid-py314-no-py",
91+
),
92+
pytest.param(VALID_CRASH_TEXT_EMPTY,"Aborted","",id="valid-empty"),
93+
pytest.param(
94+
WINDOWS_CRASH_TEXT,"Windows access violation","tabopen",id="windows"
95+
),
96+
pytest.param(INVALID_CRASH_TEXT,"","",id="invalid"),
97+
],
98+
)
5599
deftest_parse_fatal_stacktrace(text,typ,func):
56100
text=text.strip().replace('_',' ')
57101
assertcrashdialog.parse_fatal_stacktrace(text)== (typ,func)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp