[Python-Dev] Classes that claim to be defined in __builtin__ but aren't

James Y Knight foom at fuhm.net
Thu Aug 12 23:28:05 CEST 2004


On Aug 10, 2004, at 8:02 PM, Guido van Rossum wrote:
>> Sooo should (for 'generator' in objects that claim to be in
>> __builtins__ but aren't),
>> 1) 'generator' be added to __builtins__
>> 2) 'generator' be added to types.py and its __module__ be set to 
>> 'types'
>> 3) 'generator' be added to <newmodule>.py and its __module__ be set to
>> '<newmodule>' (and a name for the module chosen)
>
> I guess (1).
>
> Please submit a patch to SF...

Okay, so, I don't have a patch, but I have made a script to examine the 
situation. It seems the problem is a little more widespread than I had 
realized. I grepped through the python C source to find all the type 
objects, and then verified their existence. Just looking at 
Objects/*.c, there are 31 classes without appropriate bindings. 
Additionally, some aren't even valid identifier names. It seems like 
there's 4 categories here: iterators, descrobject stuffs, list 
comparison wrappers, and other. I'm not sure it's a good idea to add 
all these names to the builtins -- perhaps only the ones in the 'other' 
group?

For {Modules,Mac,PC,RISCOS,Python}/*.c, most seem like they could 
relatively straightforwardly be added to their module, but I haven't 
examined them too closely. Some likely ought to have constructors added 
(e.g. the dl.dl('file') could be equivalent to dl.open('file')).

__builtin__.dictionary-keyiterator   not found (./Objects/dictobject.c)
__builtin__.dictionary-valueiterator   not found 
(./Objects/dictobject.c)
__builtin__.dictionary-itemiterator   not found (./Objects/dictobject.c)
__builtin__.tupleiterator   not found (./Objects/tupleobject.c)
__builtin__.rangeiterator   not found (./Objects/rangeobject.c)
__builtin__.iterator   not found (./Objects/iterobject.c)
__builtin__.callable-iterator   not found (./Objects/iterobject.c)
__builtin__.listiterator   not found (./Objects/listobject.c)
__builtin__.listreverseiterator   not found (./Objects/listobject.c)

__builtin__.method_descriptor   not found (./Objects/descrobject.c)
__builtin__.classmethod_descriptor   not found (./Objects/descrobject.c)
__builtin__.member_descriptor   not found (./Objects/descrobject.c)
__builtin__.getset_descriptor   not found (./Objects/descrobject.c)
__builtin__.wrapper_descriptor   not found (./Objects/descrobject.c)
__builtin__.method-wrapper   not found (./Objects/descrobject.c)

__builtin__.sortwrapper   not found (./Objects/listobject.c)
__builtin__.cmpwrapper   not found (./Objects/listobject.c)

__builtin__.ellipsis   not found (./Objects/sliceobject.c)   
types.EllipsisType
__builtin__.builtin_function_or_method   not found 
(./Objects/methodobject.c)   types.BuiltinFunctionType 
types.BuiltinMethodType
__builtin__.dictproxy   not found (./Objects/descrobject.c)   
types.DictProxyType
__builtin__.generator   not found (./Objects/genobject.c)   
types.GeneratorType
__builtin__.PyCObject   not found (./Objects/cobject.c)
__builtin__.classobj   not found (./Objects/classobject.c)   
types.ClassType
__builtin__.instance   not found (./Objects/classobject.c)   
types.InstanceType
__builtin__.instancemethod   not found (./Objects/classobject.c)   
types.MethodType types.UnboundMethodType
__builtin__.cell   not found (./Objects/cellobject.c)
__builtin__.NoneType   not found (./Objects/object.c)   types.NoneType
__builtin__.NotImplementedType   not found (./Objects/object.c)   
types.NotImplementedType
__builtin__.frame   not found (./Objects/frameobject.c)   
types.FrameType
__builtin__.function   not found (./Objects/funcobject.c)   
types.FunctionType types.LambdaType
__builtin__.module   not found (./Objects/moduleobject.c)   
types.ModuleType


(the Mac ones I checked on my mac w/ python 2.3.0)
_Qt.IdleManager   not found (./Mac/Modules/qt/_Qtmodule.c)
_Qt.SGOutput   not found (./Mac/Modules/qt/_Qtmodule.c)
module _OSA not installed (./Mac/Modules/osa/_OSAmodule.c)
Nav.NavReplyRecord   not found (./Mac/Modules/Nav.c)
_Scrap.Scrap   not found (./Mac/Modules/scrap/_Scrapmodule.c)
module waste not installed (./Mac/Modules/waste/wastemodule.c)
MacOS.ResourceFork   not found (./Mac/Modules/macosmodule.c)
icglue.ic_instance   not found (./Mac/Modules/icgluemodule.c)


__builtin__.PyHKEY   not found (./PC/_winreg.c)
__builtin__.drawf   not found (./RISCOS/Modules/drawfmodule.c)
__builtin__.block   not found (./RISCOS/Modules/swimodule.c)
__builtin__.traceback   not found (./Python/traceback.c)   
types.TracebackType
__builtin__.code   not found (./Python/compile.c)   types.CodeType
__builtin__.symtable entry   not found (./Python/symtable.c)
__builtin__.tktimertoken   not found (./Modules/_tkinter.c)
__builtin__.tkapp   not found (./Modules/_tkinter.c)
__builtin__.arrayiterator   not found (./Modules/arraymodule.c)
_curses_panel.curses panel   not found (./Modules/_curses_panel.c)
linuxaudiodev.linux_audio_device   not found (./Modules/linuxaudiodev.c)
module fl not installed (./Modules/flmodule.c)
__builtin__.DB   not found (./Modules/_bsddb.c)
__builtin__.DBCursor   not found (./Modules/_bsddb.c)
__builtin__.DBEnv   not found (./Modules/_bsddb.c)
__builtin__.DBTxn   not found (./Modules/_bsddb.c)
__builtin__.DBLock   not found (./Modules/_bsddb.c)
sha.SHA   not found (./Modules/shamodule.c)
module sv not installed (./Modules/svmodule.c)
itertools._grouper   not found (./Modules/itertoolsmodule.c)
itertools.tee_dataobject   not found (./Modules/itertoolsmodule.c)
rotor.rotor   not found (./Modules/rotormodule.c)
module cl not installed (./Modules/clmodule.c)
_sre.SRE_Pattern   not found (./Modules/_sre.c)
_sre.SRE_Match   not found (./Modules/_sre.c)
_sre.SRE_Scanner   not found (./Modules/_sre.c)
socket.SSL   not found (./Modules/_ssl.c)
_curses.curses window   not found (./Modules/_cursesmodule.c)
parser.st   not found (./Modules/parsermodule.c)
cStringIO.StringO   not found (./Modules/cStringIO.c)
cStringIO.StringI   not found (./Modules/cStringIO.c)
module sunaudiodev not installed (./Modules/sunaudiodev.c)
module dbm not installed (./Modules/dbmmodule.c)
dl.dl   not found (./Modules/dlmodule.c)
module fm not installed (./Modules/fmmodule.c)
regex.regex   not found (./Modules/regexmodule.c)
pyexpat.xmlparser   not found (./Modules/pyexpat.c)
__builtin__.MultibyteCodec   not found 
(./Modules/cjkcodecs/multibytecodec.c)
__builtin__.MultibyteStreamReader   not found 
(./Modules/cjkcodecs/multibytecodec.c)
__builtin__.MultibyteStreamWriter   not found 
(./Modules/cjkcodecs/multibytecodec.c)
bsddb.bsddb   not found (./Modules/bsddbmodule.c)
module cd not installed (./Modules/cdmodule.c)
cPickle.Pdata   not found (./Modules/cPickle.c)
module al not installed (./Modules/almodule.c)
__builtin__.deque_iterator   not found (./Modules/collectionsmodule.c)
__builtin__.deque_reverse_iterator   not found 
(./Modules/collectionsmodule.c)
thread.lock   not found (./Modules/threadmodule.c)
zlib.Compress   not found (./Modules/zlibmodule.c)
zlib.Decompress   not found (./Modules/zlibmodule.c)
gdbm.gdbm   not found (./Modules/gdbmmodule.c)
ossaudiodev.oss_audio_device   not found (./Modules/ossaudiodev.c)
ossaudiodev.oss_mixer_device   not found (./Modules/ossaudiodev.c)



More information about the Python-Dev mailing list