From 5c86ea5dfcbb26afb3715a4663a96a1f53acf03a Mon Sep 17 00:00:00 2001 From: "Gustavo J. A. M. Carneiro" Date: Fri, 5 Sep 2008 16:44:58 +0100 Subject: [PATCH] Don't use copy.deepcopy; it is buggy on some Python versions. --- pybindgen/typehandlers/ctypeparser/__init__.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pybindgen/typehandlers/ctypeparser/__init__.py b/pybindgen/typehandlers/ctypeparser/__init__.py index 0346217..ba2fe66 100644 --- a/pybindgen/typehandlers/ctypeparser/__init__.py +++ b/pybindgen/typehandlers/ctypeparser/__init__.py @@ -1,5 +1,5 @@ import tokenizer -import copy + MODIFIERS = ['const', 'volatile'] # XXX: are there others? @@ -21,6 +21,9 @@ class CType(object): else: self.tokens = tokens + def clone(self): + return CType(list(self.tokens)) + def reorder_modifiers(self): """ Reoder const modifiers, as rightward as possible without @@ -298,10 +301,10 @@ class TypeTraits(object): def __init__(self, ctype): self.ctype = parse_type(ctype) - self.ctype_no_modifiers = copy.deepcopy(self.ctype) + self.ctype_no_modifiers = self.ctype.clone() self.ctype_no_modifiers.remove_modifiers() - self.ctype_no_const = copy.deepcopy(self.ctype) - tokens = copy.copy(self.ctype.tokens) + self.ctype_no_const = self.ctype.clone() + tokens = list(self.ctype.tokens) tokens.reverse() ptr_ref_level = 0 self.type_is_const = False