Index: mojo/public/tools/bindings/pylib/mojom/generate/data.py |
diff --git a/mojo/public/tools/bindings/pylib/mojom/generate/data.py b/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
index 98be283b0ae41d3b3fe9dfd9a06d567014c1cde1..52e2f7d7386d6844a5de08185e45d049dcdf803a 100644 |
--- a/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
+++ b/mojo/public/tools/bindings/pylib/mojom/generate/data.py |
@@ -134,7 +134,12 @@ def KindFromData(kinds, data, scope): |
def KindFromImport(original_kind, imported_from): |
"""Used with 'import module' - clones the kind imported from the given |
module's namespace. Only used with Structs, Interfaces and Enums.""" |
- kind = copy.deepcopy(original_kind) |
+ kind = copy.copy(original_kind) |
+ # |shared_definition| is used to store various properties (see |
+ # |AddSharedProperty()| in module.py), including |imported_from|. We don't |
+ # want the copy to share these with the original, so copy it if necessary. |
+ if hasattr(original_kind, 'shared_definition'): |
+ kind.shared_definition = copy.copy(original_kind.shared_definition) |
kind.imported_from = imported_from |
return kind |
@@ -155,7 +160,9 @@ def ImportFromData(module, data): |
# Ditto for values. |
for value in import_module.values.itervalues(): |
if value.imported_from is None: |
- value = copy.deepcopy(value) |
+ # Values don't have shared definitions (since they're not nullable), so no |
+ # need to do anything special. |
+ value = copy.copy(value) |
value.imported_from = import_item |
module.values[value.GetSpec()] = value |