[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
This commit is contained in:
parent
ea4f9c4625
commit
13fec4a21c
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue