[New-bugs-announce] [issue2199] cPickle error with gtk GEnum classes

PyScripter report at bugs.python.org
Thu Feb 28 14:46:24 CET 2008


New submission from PyScripter:

cPickle has problems loading instances of gtk gobject.GEnum classes. 
gobject.GEnum is a subclass of int.  On the other hand pickle handles
those classes correctly.  Since cPickle is meant to be a faster version
of pickle this needs to be consider a bug.  

To test run the following script:

import gtk
##import pickle
import cPickle as pickle

simple_types = (
    bool,
    int,
    long,
    float,
    complex,
    basestring,
    type(None),
)


d = vars(gtk)
for (i,j) in d.iteritems():
    if isinstance(j, simple_types):
        try:
            s = pickle.dumps(j, pickle.HIGHEST_PROTOCOL)
            obj = pickle.loads(s)
        except (ValueError, TypeError):
            print j, type(j)

If you replace cPickle with pickle then the script runs fine.

----------
components: Library (Lib)
messages: 63091
nosy: pyscripter
severity: normal
status: open
title: cPickle error with gtk GEnum classes
versions: Python 2.5

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2199>
__________________________________


More information about the New-bugs-announce mailing list