[FIX] profiler: manage frame without lineno

In some case the frame may have a filename and corresponding file but
no lineno. This may lead to an error

File ".../odoo/tools/profiler.py", line 571, in _add_file_lines
    line = filelines[lineno - 1]
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

This commit simply fixes this by skipping the logic if we have no lineno.

closes odoo/odoo#98217

X-original-commit: 44715af97413da3608e99f211c361a498f25d964
Signed-off-by: Raphael Collet <rco@odoo.com>
Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
This commit is contained in:
Xavier-Do
2022-08-17 11:21:50 +02:00
parent 2656bcf55d
commit 421d500842
+2
View File
@@ -623,6 +623,8 @@ class Profiler:
if line != '':
continue
# retrieve file lines from the filecache
if not lineno:
continue
try:
filelines = self.filecache[filename]
except KeyError: