summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2002-03-05 13:58:42 (GMT)
committerMichael W. Hudson <mwh@python.net>2002-03-05 13:58:42 (GMT)
commit234bb740f71381a8086818f56a5b92f9155d4fe1 (patch)
tree6bf2dd46b45c46274c2a2b3144c5b2db4c6c946c
parentc10d570d050a1de9751c0422f42b96e0c240243d (diff)
downloadcpython-234bb740f71381a8086818f56a5b92f9155d4fe1.zip
cpython-234bb740f71381a8086818f56a5b92f9155d4fe1.tar.gz
cpython-234bb740f71381a8086818f56a5b92f9155d4fe1.tar.bz2
backport gvanrossum's checkin of
revision 1.24 of copy.py SF patch 518765 (Derek Harland): Bug in copy.py when used through rexec. When using a restricted environment, imports of copy will fail with an AttributeError when trying to access types.CodeType. Bugfix candidate (all the way back to 1.5.3, but at least 2.1.3 and 2.2.1).
-rw-r--r--Lib/copy.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/copy.py b/Lib/copy.py
index 86fc978..cf0b1af 100644
--- a/Lib/copy.py
+++ b/Lib/copy.py
@@ -197,7 +197,10 @@ try:
d[types.UnicodeType] = _deepcopy_atomic
except AttributeError:
pass
-d[types.CodeType] = _deepcopy_atomic
+try:
+ d[types.CodeType] = _deepcopy_atomic
+except AttributeError:
+ pass
d[types.TypeType] = _deepcopy_atomic
d[types.XRangeType] = _deepcopy_atomic