diff options
| author | fw-bot <otis@odoo.com> | 2019-10-24 15:54:00 +0000 |
|---|---|---|
| committer | fw-bot <otis@odoo.com> | 2019-10-29 15:57:20 +0000 |
| commit | fd06a7fe14378b1a7d50ac815b08033ebe2e7d3b (patch) | |
| tree | 19b202b13eca6cb15cb6efb28462dc1faea21dd5 /odoo/tools/profiler.py | |
| parent | 0562940f2c0cfb5483ba1043fffc86988d97445a (diff) | |
[FIX] profiler: be more pesimistic
The profiler was too optimistic. If the local variable self was not a
cursor, it assumed it was automatically an Odoo model.
Instead, only do the custom tracer methods when self is an instance of
BaseModel.
Full scenario to reproduce explained at odoo/odoo#39237
In case a method like the default_get of utm.mixing was profiled, the
tracer crashed when evaluating `__bool__(request)`.
The tracer considered self as an Odoo model while it was a werkzeug
instance with its custom __getattr__ that crashed while trying to
retrieve the content of `_name`.
Fixes odoo/odoo#39237
closes odoo/odoo#39524
X-original-commit: c8fa8fb067dcfb15330acde35d66ac41a255f669
Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
Diffstat (limited to 'odoo/tools/profiler.py')
| -rw-r--r-- | odoo/tools/profiler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/odoo/tools/profiler.py b/odoo/tools/profiler.py index e44dfadac1f..85d4f00b633 100644 --- a/odoo/tools/profiler.py +++ b/odoo/tools/profiler.py @@ -35,7 +35,7 @@ class _LogTracer(object): in_self = frame.f_locals['self'] - if isinstance(in_self, (odoo.sql_db.Cursor, odoo.sql_db.TestCursor)): + if not isinstance(in_self, odoo.models.BaseModel): return self.tracer model = getattr(in_self, '_name', None) |
