]> granicus.if.org Git - python/commitdiff
Patch by Finn Bock to support PyStringMap in Jython.
authorGuido van Rossum <guido@python.org>
Mon, 27 Nov 2000 21:53:14 +0000 (21:53 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 27 Nov 2000 21:53:14 +0000 (21:53 +0000)
Lib/copy.py

index 9576575e20830eb75eb386da1acf1ba9cf188ecb..fc2e1ff18e72e942795951335e7dba28d448b14d 100644 (file)
@@ -56,6 +56,11 @@ class Error(Exception):
        pass
 error = Error  # backward compatibility
 
+try:
+    from org.python.core import PyStringMap
+except ImportError:
+    PyStringMap = None
+
 def copy(x):
        """Shallow copy operation on arbitrary Python objects.
 
@@ -104,6 +109,8 @@ d[types.TupleType] = _copy_tuple
 def _copy_dict(x):
        return x.copy()
 d[types.DictionaryType] = _copy_dict
+if PyStringMap is not None:
+    d[PyStringMap] = _copy_dict
 
 def _copy_inst(x):
        if hasattr(x, '__copy__'):
@@ -200,6 +207,8 @@ def _deepcopy_dict(x, memo):
                y[deepcopy(key, memo)] = deepcopy(x[key], memo)
        return y
 d[types.DictionaryType] = _deepcopy_dict
+if PyStringMap is not None:
+    d[PyStringMap] = _deepcopy_dict
 
 def _keep_alive(x, memo):
        """Keeps a reference to the object x in the memo.