[Patches] [ python-Patches-518765 ] Bug in copy.py when used through rexec
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 28 Feb 2002 15:19:16 -0800
Patches item #518765, was opened at 2002-02-17 09:53
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=518765&group_id=5470
Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Derek Harland (dharland)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Bug in copy.py when used through rexec
Initial Comment:
Version: In all versions since Python 1.5.2 up to the
current Python 2.3a0
Platforms: All
When using a restricted environment, imports of copy
will fail with an AttributeError when trying to
access types.CodeType.
This occurs while trying to set up the deepcopy
helper dictionary. The creation of the shallow copy
helper dictionary works fine as the attempt to
extract types.CodeType is explicitly wrapped in a try.
This very minor patch adds the same try except
wrapper for the deepcopy setup.
example:
>>> import rexec
>>> rexec.RExec().r_import('copy')
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/rexec.py",
line 265, in r_import
return self.importer.import_module(mname,
globals, locals, fromlist)
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/ihooks.py",
line 397, in import_module
q, tail = self.find_head_package(parent, name)
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/ihooks.py",
line 433, in find_head_package
q = self.import_it(head, qname, parent)
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/ihooks.py",
line 486, in import_it
m = self.loader.load_module(fqname, stuff)
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/ihooks.py",
line 325, in load_module
exec code in m.__dict__
File
"/home/harland/dev/sourceforge/python/dist/src/Lib/copy.py",
line 200, in ?
d[types.CodeType] = _deepcopy_atomic
AttributeError: 'module' object has no attribute
'CodeType'
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2002-02-28 18:19
Message:
Logged In: YES
user_id=6380
Thanks! Fixed.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=518765&group_id=5470