From bc4feb42b580bbe27222284b1d49494f3253e41d Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Wed, 12 Mar 2003 01:32:48 +0000 Subject: [PATCH] - fixed "deepcopy" of infos bug [SVN r17824] --- pyste/src/infos.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pyste/src/infos.py b/pyste/src/infos.py index 3d23537e..ce8334c5 100644 --- a/pyste/src/infos.py +++ b/pyste/src/infos.py @@ -12,18 +12,20 @@ from exporterutils import FunctionWrapper #============================================================================== # DeclarationInfo #============================================================================== -class DeclarationInfo(object): +class DeclarationInfo: def __init__(self, otherInfo=None): self.__infos = {} self.__attributes = {} if otherInfo is not None: - self.__infos = otherInfo.__infos.copy() - self.__attributes = otherInfo.__attributes.copy() + self.__infos = copy.deepcopy(otherInfo.__infos) + self.__attributes = copy.deepcopy(otherInfo.__attributes) def __getitem__(self, name): 'Used to access sub-infos' + if name.startswith('__'): + raise AttributeError default = DeclarationInfo() default._Attribute('name', name) return self.__infos.setdefault(name, default) @@ -61,8 +63,8 @@ class FunctionInfo(DeclarationInfo): #============================================================================== class ClassInfo(DeclarationInfo): - def __init__(self, name, include, tail=None, otherOption=None): - DeclarationInfo.__init__(self, otherOption) + def __init__(self, name, include, tail=None, otherInfo=None): + DeclarationInfo.__init__(self, otherInfo) self._Attribute('name', name) self._Attribute('include', include) # create a ClassExporter