types.CodeType doesnt exist?

Thomas Wouters thomas at xs4all.net
Fri Jun 29 16:33:03 EDT 2001


On Fri, Jun 29, 2001 at 06:13:47AM -0700, gods1child wrote:
> Platform: Win2000, Python 2.0

> I was looking at the copy.py source and found this snippet
> -----------------------------------------------------
> d = {}
> d[types.UnicodeType] = _copy_atomic
> try:
> 	d[types.CodeType] = _copy_atomic
> except AttributeError:
> 	pass
> d[types.TypeType] = _copy_atomic
> -----------------------------------------------------
> under what circumstances will the types module not have attribute CodeType?

When running in restricted mode, according to this checkin message:

revision 1.8 (of types.py)
date: 1997/09/04 22:12:34;  author: guido;  state: Exp;  lines: +15 -6
Added some try-excepts so that it can be imported in restricted mode
(though some type names are undefined in that case, e.g. CodeType
(inaccessible), FileType (not always accessible), and TracebackType
and FrameType (inaccessible).

Aint-CVS-fun-ly y'rs,

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list