From 421d5008427b687d239bc01bbabdcc5c6db5ff62 Mon Sep 17 00:00:00 2001 From: Xavier-Do Date: Tue, 16 Aug 2022 10:09:43 +0000 Subject: [PATCH] [FIX] profiler: manage frame without lineno MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Xavier Dollé (xdo) --- odoo/tools/profiler.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/odoo/tools/profiler.py b/odoo/tools/profiler.py index 28c7dac4d76..a95675b1e58 100644 --- a/odoo/tools/profiler.py +++ b/odoo/tools/profiler.py @@ -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: