Commit abcce76
Fix crash when traceback frame has tb_lineno=None
When formatting exceptions, Loguru calls linecache.getline() with the
line number from traceback frames. In some edge cases on Python 3.12+,
tb_lineno can be None (see CPython issues #139531, #89726), which
causes a TypeError in linecache.getline().
This fix guards against None lineno values by returning an empty source
string in that case, allowing the exception to be logged even if the
source line cannot be retrieved.
Fixes #1435
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 764cd30 commit abcce76
1 file changed
+5
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
208 | 208 | | |
209 | 209 | | |
210 | 210 | | |
211 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
212 | 216 | | |
213 | 217 | | |
214 | 218 | | |
| |||
0 commit comments