From 13fec4a21c169714c8e227949cfe62daf18f163c Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 20 Apr 2015 11:00:09 +0200 Subject: [PATCH] [FIX] core: avoid infinite recursive loop. `function` fields are fully copied via `copy.copy()`. `copy.copy()` *do not* call `__init__` after object creation; then restore the state via `__setstate__()` or by updating `__dict__` or via `setattr()` when the object uses `__slots__`. As `__init__` is not called, the newly created object does not have any `_args` attribute. This lead to a recursive call of `__getattr__ when `copy.copy` check the existance of `__setstate__` attribute. When break this loop by forbidding explicitly by checking the attribute name accessed (We cannot check the presence of `_args` in `__dict__` because we uses `__slots__`). See http://bugs.python.org/issue5370 Fixes #6037 opw:633109 --- openerp/osv/fields.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 0ca684253b5..e9c2c38f97c 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -151,6 +151,8 @@ class _column(object): def __getattr__(self, name): """ Access a non-slot attribute. """ + if name == '_args': + raise AttributeError(name) try: return self._args[name] except KeyError: